version 12.1
******** FIGURE A10 Marginal effects over reference attributes by task number (diagnostics for carry over effects)  
use data.dta, clear

***** Setting the mean or modal values for the respondent-level variables
* pol_interest = 3.3
sum pol_interest if pol_interest!=. & left_right!=.n & gender!=. & age!=. & italian!=. & ftstudent!=. & lyceum!=. & edu_imp!=. & inc_imp!=. & hon_imp!=. & Y!=.
scalar h_pinterest=3.3
* left_right = 4.2
sum left_right if pol_interest!=. & left_right!=.n & gender!=. & age!=. & italian!=. & ftstudent!=. & lyceum!=. & edu_imp!=. & inc_imp!=. & hon_imp!=. & Y!=.
scalar h_leftright=4.2
* gender =0 (female)
table gender if pol_interest!=. & left_right!=.n & gender!=. & age!=. & italian!=. & ftstudent!=. & lyceum!=. & edu_imp!=. & inc_imp!=. & hon_imp!=. & Y!=.
scalar h_gender=0
* age = 21.4
sum age if pol_interest!=. & left_right!=.n & gender!=. & age!=. & italian!=. & ftstudent!=. & lyceum!=. & edu_imp!=. & inc_imp!=. & hon_imp!=. & Y!=.
scalar h_age=21.4
* italian = 1
table italian if pol_interest!=. & left_right!=.n & gender!=. & age!=. & italian!=. & ftstudent!=. & lyceum!=. & edu_imp!=. & inc_imp!=. & hon_imp!=. & Y!=.
scalar h_italian=1
* student = 1
table ftstudent if pol_interest!=. & left_right!=.n & gender!=. & age!=. & italian!=. & ftstudent!=. & lyceum!=. & edu_imp!=. & inc_imp!=. & hon_imp!=. & Y!=.
scalar h_student=1
* lyceum = 1
table lyceum if pol_interest!=. & left_right!=.n & gender!=. & age!=. & italian!=. & ftstudent!=. & lyceum!=. & edu_imp!=. & inc_imp!=. & hon_imp!=. & Y!=.
scalar h_lyceum=1
* edu_imp = 3.1
sum edu_imp if pol_interest!=. & left_right!=.n & gender!=. & age!=. & italian!=. & ftstudent!=. & lyceum!=. & edu_imp!=. & inc_imp!=. & hon_imp!=. & Y!=.
scalar h_eduimp=3.1
* inc_imp = 1.9
sum inc_imp if pol_interest!=. & left_right!=.n & gender!=. & age!=. & italian!=. & ftstudent!=. & lyceum!=. & edu_imp!=. & inc_imp!=. & hon_imp!=. & Y!=.
scalar h_incimp=1.9
* hon_imp = 3.9
sum hon_imp if pol_interest!=. & left_right!=.n & gender!=. & age!=. & italian!=. & ftstudent!=. & lyceum!=. & edu_imp!=. & inc_imp!=. & hon_imp!=. & Y!=.
scalar h_honimp=3.9
* taxspend_imp = 3.7
sum taxspend_imp if pol_interest!=. & left_right!=.n & gender!=. & age!=. & italian!=. & ftstudent!=. & lyceum!=. & edu_imp!=. & taxspend_imp!=. & samesex_imp!=. & Y!=.
scalar h_taximp=3.7
* samesex_imp = 3.4
sum samesex_imp if pol_interest!=. & left_right!=.n & gender!=. & age!=. & italian!=. & ftstudent!=. & lyceum!=. & edu_imp!=. & taxspend_imp!=. & samesex_imp!=. & Y!=.
scalar h_sseximp=3.4 
* survey =1 (2013)
table survey if pol_interest!=. & left_right!=.n & gender!=. & age!=. & italian!=. & ftstudent!=. & lyceum!=. & edu_imp!=. & inc_imp!=. & hon_imp!=. & Y!=.
scalar h_survey=1

* Note: Non-varying or relevant candidate attributes are set at their baseline values (junior high school diploma, low income, clean, more taxation and spending, same rights to same sex-couples)

**************************************************  TASK NO.1
**********   EDUCATION (TASK NO.1)
* Education: Junior High (Edu1) at Same rights (Samesex1) and 'More tax-spend' candidate (Tax1)
estimates use m10_coeEDU.ster
est des
preserve
drawnorm MG_b1-MG_b232, n(10000) means(e(b)) cov(e(V)) clear seed(1)
postutil clear
postfile mypost prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi using sim.dta, replace
noisily display "start"
generate x_betahat0 = MG_b232 + MG_b1
generate x_betahat1 = MG_b232 + MG_b1
gen prob0=normal(x_betahat0)
gen prob1=normal(x_betahat1)
gen diff=prob1-prob0
egen probhat0=mean(prob0)
egen probhat1=mean(prob1)
egen diffhat=mean(diff)
tempname prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi   
_pctile prob0, p(2.5,97.5) 
scalar `lo0' = r(r1)
scalar `hi0' = r(r2)  
_pctile prob1, p(2.5,97.5)
scalar `lo1'= r(r1)
scalar `hi1'= r(r2)  
_pctile diff, p(2.5,97.5)
scalar `diff_lo'= r(r1)
scalar `diff_hi'= r(r2)  
scalar `prob_hat0'=probhat0
scalar `prob_hat1'=probhat1
scalar `diff_hat'=diffhat
post mypost (`prob_hat0') (`lo0') (`hi0') (`prob_hat1') (`lo1') (`hi1') (`diff_hat') (`diff_lo') (`diff_hi')
drop x_betahat0 x_betahat1 prob0 prob1 diff probhat0 probhat1 diffhat 
display ""
postclose mypost
use sim.dta, clear
save sim2.dta, replace
restore, not
**********   EDUCATION * SAMESEX Interaction
* Education: High school vs. Middle-junior high (Edu2 vs Edu1) at Same rights (Samesex1) and 'More tax-spend' candidate (Tax1)
estimates use m10_coeEDU.ster
est des
preserve
drawnorm MG_b1-MG_b232, n(10000) means(e(b)) cov(e(V)) clear seed(1)
postutil clear
postfile mypost prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi using sim.dta, replace
noisily display "start"
generate x_betahat0 = MG_b232 + MG_b1
generate x_betahat1 = MG_b232 + MG_b2 ///
+ MG_b16*h_pinterest + MG_b22*h_leftright + MG_b28*h_gender + MG_b34*h_age + MG_b40*h_italian + MG_b46*h_student + MG_b52*h_lyceum + MG_b58*h_eduimp + MG_b114*h_survey
gen prob0=normal(x_betahat0)
gen prob1=normal(x_betahat1)
gen diff=prob1-prob0
egen probhat0=mean(prob0)
egen probhat1=mean(prob1)
egen diffhat=mean(diff)
tempname prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi   
_pctile prob0, p(2.5,97.5) 
scalar `lo0' = r(r1)
scalar `hi0' = r(r2)  
_pctile prob1, p(2.5,97.5)
scalar `lo1'= r(r1)
scalar `hi1'= r(r2)  
_pctile diff, p(2.5,97.5)
scalar `diff_lo'= r(r1)
scalar `diff_hi'= r(r2)  
scalar `prob_hat0'=probhat0
scalar `prob_hat1'=probhat1
scalar `diff_hat'=diffhat
post mypost (`prob_hat0') (`lo0') (`hi0') (`prob_hat1') (`lo1') (`hi1') (`diff_hat') (`diff_lo') (`diff_hi')
drop x_betahat0 x_betahat1 prob0 prob1 diff probhat0 probhat1 diffhat 
display ""
postclose mypost
use sim2.dta, clear
append using sim.dta
save sim2.dta, replace
restore, not
* Education: High school vs. Middle-junior high (Edu2 vs Edu1) at Some rights (Samesex2) and 'More tax-spend' candidate (Tax1)
estimates use m10_coeEDU.ster
est des
preserve
drawnorm MG_b1-MG_b232, n(10000) means(e(b)) cov(e(V)) clear seed(1)
postutil clear
postfile mypost prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi using sim.dta, replace
noisily display "start"
generate x_betahat0 = MG_b232 + MG_b1
generate x_betahat1 = MG_b232 + MG_b2 ///
+ MG_b16*h_pinterest + MG_b22*h_leftright + MG_b28*h_gender + MG_b34*h_age + MG_b40*h_italian + MG_b46*h_student + MG_b52*h_lyceum + MG_b58*h_eduimp ///
+ MG_b66*h_pinterest + MG_b70*h_leftright + MG_b74*h_gender + MG_b78*h_age + MG_b82*h_italian + MG_b86*h_student + MG_b90*h_lyceum + MG_b94*h_sseximp ///
+ MG_b109 + MG_b114*h_survey + MG_b122*h_survey
gen prob0=normal(x_betahat0)
gen prob1=normal(x_betahat1)
gen diff=prob1-prob0
egen probhat0=mean(prob0)
egen probhat1=mean(prob1)
egen diffhat=mean(diff)
tempname prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi   
_pctile prob0, p(2.5,97.5) 
scalar `lo0' = r(r1)
scalar `hi0' = r(r2)  
_pctile prob1, p(2.5,97.5)
scalar `lo1'= r(r1)
scalar `hi1'= r(r2)  
_pctile diff, p(2.5,97.5)
scalar `diff_lo'= r(r1)
scalar `diff_hi'= r(r2)  
scalar `prob_hat0'=probhat0
scalar `prob_hat1'=probhat1
scalar `diff_hat'=diffhat
post mypost (`prob_hat0') (`lo0') (`hi0') (`prob_hat1') (`lo1') (`hi1') (`diff_hat') (`diff_lo') (`diff_hi')
drop x_betahat0 x_betahat1 prob0 prob1 diff probhat0 probhat1 diffhat 
display ""
postclose mypost
use sim2.dta, clear
append using sim.dta
save sim2.dta, replace
restore, not
* Education: High school vs. Middle-junior high (Edu2 vs Edu1) at No rights (Samesex3) and 'More tax-spend' candidate (Tax1)
estimates use m10_coeEDU.ster
est des
preserve
drawnorm MG_b1-MG_b232, n(10000) means(e(b)) cov(e(V)) clear seed(1)
postutil clear
postfile mypost prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi using sim.dta, replace
noisily display "start"
generate x_betahat0 = MG_b232 + MG_b1
generate x_betahat1 = MG_b232 + MG_b2 ///
+ MG_b16*h_pinterest + MG_b22*h_leftright + MG_b28*h_gender + MG_b34*h_age + MG_b40*h_italian + MG_b46*h_student + MG_b52*h_lyceum + MG_b58*h_eduimp ///
+ MG_b67*h_pinterest + MG_b71*h_leftright + MG_b75*h_gender + MG_b79*h_age + MG_b83*h_italian + MG_b87*h_student + MG_b91*h_lyceum + MG_b95*h_sseximp ///
+ MG_b110 + MG_b114*h_survey + MG_b123*h_survey
gen prob0=normal(x_betahat0)
gen prob1=normal(x_betahat1)
gen diff=prob1-prob0
egen probhat0=mean(prob0)
egen probhat1=mean(prob1)
egen diffhat=mean(diff)
tempname prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi   
_pctile prob0, p(2.5,97.5) 
scalar `lo0' = r(r1)
scalar `hi0' = r(r2)  
_pctile prob1, p(2.5,97.5)
scalar `lo1'= r(r1)
scalar `hi1'= r(r2)  
_pctile diff, p(2.5,97.5)
scalar `diff_lo'= r(r1)
scalar `diff_hi'= r(r2)  
scalar `prob_hat0'=probhat0
scalar `prob_hat1'=probhat1
scalar `diff_hat'=diffhat
post mypost (`prob_hat0') (`lo0') (`hi0') (`prob_hat1') (`lo1') (`hi1') (`diff_hat') (`diff_lo') (`diff_hi')
drop x_betahat0 x_betahat1 prob0 prob1 diff probhat0 probhat1 diffhat 
display ""
postclose mypost
use sim2.dta, clear
append using sim.dta
save sim2.dta, replace
restore, not
**********   EDUCATION * SAMESEX Interaction
* Education: High school vs. Middle-junior high (Edu2 vs Edu1) at Same rights (Samesex1) and 'Keep tax and spend' candidate (Tax2)
estimates use m10_coeEDU.ster
est des
preserve
drawnorm MG_b1-MG_b232, n(10000) means(e(b)) cov(e(V)) clear seed(1)
postutil clear
postfile mypost prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi using sim.dta, replace
noisily display "start"
generate x_betahat0 = MG_b232 + MG_b1
generate x_betahat1 = MG_b232 + MG_b2 ///
+ MG_b16*h_pinterest + MG_b22*h_leftright + MG_b28*h_gender + MG_b34*h_age + MG_b40*h_italian + MG_b46*h_student + MG_b52*h_lyceum + MG_b58*h_eduimp ///
+ MG_b64*h_pinterest + MG_b68*h_leftright + MG_b72*h_gender + MG_b76*h_age + MG_b80*h_italian + MG_b84*h_student + MG_b88*h_lyceum + MG_b92*h_taximp ///
+ MG_b100 + MG_b114*h_survey + MG_b120*h_survey
gen prob0=normal(x_betahat0)
gen prob1=normal(x_betahat1)
gen diff=prob1-prob0
egen probhat0=mean(prob0)
egen probhat1=mean(prob1)
egen diffhat=mean(diff)
tempname prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi   
_pctile prob0, p(2.5,97.5) 
scalar `lo0' = r(r1)
scalar `hi0' = r(r2)  
_pctile prob1, p(2.5,97.5)
scalar `lo1'= r(r1)
scalar `hi1'= r(r2)  
_pctile diff, p(2.5,97.5)
scalar `diff_lo'= r(r1)
scalar `diff_hi'= r(r2)  
scalar `prob_hat0'=probhat0
scalar `prob_hat1'=probhat1
scalar `diff_hat'=diffhat
post mypost (`prob_hat0') (`lo0') (`hi0') (`prob_hat1') (`lo1') (`hi1') (`diff_hat') (`diff_lo') (`diff_hi')
drop x_betahat0 x_betahat1 prob0 prob1 diff probhat0 probhat1 diffhat 
display ""
postclose mypost
use sim2.dta, clear
append using sim.dta
save sim2.dta, replace
restore, not
* Education: High school vs. Middle-junior high (Edu2 vs Edu1) at Some rights (Samesex2) and 'Keep tax and spend' candidate (Tax2)
estimates use m10_coeEDU.ster
est des
preserve
drawnorm MG_b1-MG_b232, n(10000) means(e(b)) cov(e(V)) clear seed(1)
postutil clear
postfile mypost prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi using sim.dta, replace
noisily display "start"
generate x_betahat0 = MG_b232 + MG_b1
generate x_betahat1 = MG_b232 + MG_b2 ///
+ MG_b16*h_pinterest + MG_b22*h_leftright + MG_b28*h_gender + MG_b34*h_age + MG_b40*h_italian + MG_b46*h_student + MG_b52*h_lyceum + MG_b58*h_eduimp ///
+ MG_b64*h_pinterest + MG_b68*h_leftright + MG_b72*h_gender + MG_b76*h_age + MG_b80*h_italian + MG_b84*h_student + MG_b88*h_lyceum + MG_b92*h_taximp ///
+ MG_b66*h_pinterest + MG_b70*h_leftright + MG_b74*h_gender + MG_b78*h_age + MG_b82*h_italian + MG_b86*h_student + MG_b90*h_lyceum + MG_b94*h_sseximp ///
+ MG_b100 + MG_b109 + MG_b114*h_survey + MG_b120*h_survey + MG_b122*h_survey
gen prob0=normal(x_betahat0)
gen prob1=normal(x_betahat1)
gen diff=prob1-prob0
egen probhat0=mean(prob0)
egen probhat1=mean(prob1)
egen diffhat=mean(diff)
tempname prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi   
_pctile prob0, p(2.5,97.5) 
scalar `lo0' = r(r1)
scalar `hi0' = r(r2)  
_pctile prob1, p(2.5,97.5)
scalar `lo1'= r(r1)
scalar `hi1'= r(r2)  
_pctile diff, p(2.5,97.5)
scalar `diff_lo'= r(r1)
scalar `diff_hi'= r(r2)  
scalar `prob_hat0'=probhat0
scalar `prob_hat1'=probhat1
scalar `diff_hat'=diffhat
post mypost (`prob_hat0') (`lo0') (`hi0') (`prob_hat1') (`lo1') (`hi1') (`diff_hat') (`diff_lo') (`diff_hi')
drop x_betahat0 x_betahat1 prob0 prob1 diff probhat0 probhat1 diffhat 
display ""
postclose mypost
use sim2.dta, clear
append using sim.dta
save sim2.dta, replace
restore, not
* Education: High school vs. Middle-junior high (Edu2 vs Edu1) at No rights (Samesex3) and 'Keep tax and spend' candidate (Tax2)
estimates use m10_coeEDU.ster
est des
preserve
drawnorm MG_b1-MG_b232, n(10000) means(e(b)) cov(e(V)) clear seed(1)
postutil clear
postfile mypost prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi using sim.dta, replace
noisily display "start"
generate x_betahat0 = MG_b232 + MG_b1
generate x_betahat1 = MG_b232 + MG_b2 ///
+ MG_b16*h_pinterest + MG_b22*h_leftright + MG_b28*h_gender + MG_b34*h_age + MG_b40*h_italian + MG_b46*h_student + MG_b52*h_lyceum + MG_b58*h_eduimp ///
+ MG_b64*h_pinterest + MG_b68*h_leftright + MG_b72*h_gender + MG_b76*h_age + MG_b80*h_italian + MG_b84*h_student + MG_b88*h_lyceum + MG_b92*h_taximp ///
+ MG_b67*h_pinterest + MG_b71*h_leftright + MG_b75*h_gender + MG_b79*h_age + MG_b83*h_italian + MG_b87*h_student + MG_b91*h_lyceum + MG_b95*h_sseximp ///
+ MG_b100 + MG_b110 + MG_b114*h_survey + MG_b120*h_survey + MG_b123*h_survey
gen prob0=normal(x_betahat0)
gen prob1=normal(x_betahat1)
gen diff=prob1-prob0
egen probhat0=mean(prob0)
egen probhat1=mean(prob1)
egen diffhat=mean(diff)
tempname prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi   
_pctile prob0, p(2.5,97.5) 
scalar `lo0' = r(r1)
scalar `hi0' = r(r2)  
_pctile prob1, p(2.5,97.5)
scalar `lo1'= r(r1)
scalar `hi1'= r(r2)  
_pctile diff, p(2.5,97.5)
scalar `diff_lo'= r(r1)
scalar `diff_hi'= r(r2)  
scalar `prob_hat0'=probhat0
scalar `prob_hat1'=probhat1
scalar `diff_hat'=diffhat
post mypost (`prob_hat0') (`lo0') (`hi0') (`prob_hat1') (`lo1') (`hi1') (`diff_hat') (`diff_lo') (`diff_hi')
drop x_betahat0 x_betahat1 prob0 prob1 diff probhat0 probhat1 diffhat 
display ""
postclose mypost
use sim2.dta, clear
append using sim.dta
save sim2.dta, replace
restore, not
**********   EDUCATION * SAMESEX Interaction
* Education: High school vs. Middle-junior high (Edu2 vs Edu1) at Same rights (Samesex1) and 'Cut tax and spend' candidate (Tax3)
estimates use m10_coeEDU.ster
est des
preserve
drawnorm MG_b1-MG_b232, n(10000) means(e(b)) cov(e(V)) clear seed(1)
postutil clear
postfile mypost prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi using sim.dta, replace
noisily display "start"
generate x_betahat0 = MG_b232 + MG_b1
generate x_betahat1 = MG_b232 + MG_b2 ///
+ MG_b16*h_pinterest + MG_b22*h_leftright + MG_b28*h_gender + MG_b34*h_age + MG_b40*h_italian + MG_b46*h_student + MG_b52*h_lyceum + MG_b58*h_eduimp ///
+ MG_b65*h_pinterest + MG_b69*h_leftright + MG_b73*h_gender + MG_b77*h_age + MG_b81*h_italian + MG_b85*h_student + MG_b89*h_lyceum + MG_b93*h_taximp ///
+ MG_b101 + MG_b114*h_survey + MG_b121*h_survey
gen prob0=normal(x_betahat0)
gen prob1=normal(x_betahat1)
gen diff=prob1-prob0
egen probhat0=mean(prob0)
egen probhat1=mean(prob1)
egen diffhat=mean(diff)
tempname prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi   
_pctile prob0, p(2.5,97.5) 
scalar `lo0' = r(r1)
scalar `hi0' = r(r2)  
_pctile prob1, p(2.5,97.5)
scalar `lo1'= r(r1)
scalar `hi1'= r(r2)  
_pctile diff, p(2.5,97.5)
scalar `diff_lo'= r(r1)
scalar `diff_hi'= r(r2)  
scalar `prob_hat0'=probhat0
scalar `prob_hat1'=probhat1
scalar `diff_hat'=diffhat
post mypost (`prob_hat0') (`lo0') (`hi0') (`prob_hat1') (`lo1') (`hi1') (`diff_hat') (`diff_lo') (`diff_hi')
drop x_betahat0 x_betahat1 prob0 prob1 diff probhat0 probhat1 diffhat 
display ""
postclose mypost
use sim2.dta, clear
append using sim.dta
save sim2.dta, replace
restore, not
* Education: High school vs. Middle-junior high (Edu2 vs Edu1) at Some rights (Samesex2) and 'Cut tax and spend' candidate (Tax3)
estimates use m10_coeEDU.ster
est des
preserve
drawnorm MG_b1-MG_b232, n(10000) means(e(b)) cov(e(V)) clear seed(1)
postutil clear
postfile mypost prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi using sim.dta, replace
noisily display "start"
generate x_betahat0 = MG_b232 + MG_b1
generate x_betahat1 = MG_b232 + MG_b2 ///
+ MG_b16*h_pinterest + MG_b22*h_leftright + MG_b28*h_gender + MG_b34*h_age + MG_b40*h_italian + MG_b46*h_student + MG_b52*h_lyceum + MG_b58*h_eduimp ///
+ MG_b65*h_pinterest + MG_b69*h_leftright + MG_b73*h_gender + MG_b77*h_age + MG_b81*h_italian + MG_b85*h_student + MG_b89*h_lyceum + MG_b93*h_taximp ///
+ MG_b66*h_pinterest + MG_b70*h_leftright + MG_b74*h_gender + MG_b78*h_age + MG_b82*h_italian + MG_b86*h_student + MG_b90*h_lyceum + MG_b94*h_sseximp ///
+ MG_b101 + MG_b109 + MG_b114*h_survey + MG_b121*h_survey + MG_b122*h_survey
gen prob0=normal(x_betahat0)
gen prob1=normal(x_betahat1)
gen diff=prob1-prob0
egen probhat0=mean(prob0)
egen probhat1=mean(prob1)
egen diffhat=mean(diff)
tempname prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi   
_pctile prob0, p(2.5,97.5) 
scalar `lo0' = r(r1)
scalar `hi0' = r(r2)  
_pctile prob1, p(2.5,97.5)
scalar `lo1'= r(r1)
scalar `hi1'= r(r2)  
_pctile diff, p(2.5,97.5)
scalar `diff_lo'= r(r1)
scalar `diff_hi'= r(r2)  
scalar `prob_hat0'=probhat0
scalar `prob_hat1'=probhat1
scalar `diff_hat'=diffhat
post mypost (`prob_hat0') (`lo0') (`hi0') (`prob_hat1') (`lo1') (`hi1') (`diff_hat') (`diff_lo') (`diff_hi')
drop x_betahat0 x_betahat1 prob0 prob1 diff probhat0 probhat1 diffhat 
display ""
postclose mypost
use sim2.dta, clear
append using sim.dta
save sim2.dta, replace
restore, not
* Education: High school vs. Middle-junior high (Edu2 vs Edu1) at No rights (Samesex3)  and 'Cut tax and spend' candidate (Tax3)
estimates use m10_coeEDU.ster
est des
preserve
drawnorm MG_b1-MG_b232, n(10000) means(e(b)) cov(e(V)) clear seed(1)
postutil clear
postfile mypost prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi using sim.dta, replace
noisily display "start"
generate x_betahat0 = MG_b232 + MG_b1
generate x_betahat1 = MG_b232 + MG_b2 ///
+ MG_b16*h_pinterest + MG_b22*h_leftright + MG_b28*h_gender + MG_b34*h_age + MG_b40*h_italian + MG_b46*h_student + MG_b52*h_lyceum + MG_b58*h_eduimp ///
+ MG_b65*h_pinterest + MG_b69*h_leftright + MG_b73*h_gender + MG_b77*h_age + MG_b81*h_italian + MG_b85*h_student + MG_b89*h_lyceum + MG_b93*h_taximp ///
+ MG_b67*h_pinterest + MG_b71*h_leftright + MG_b75*h_gender + MG_b79*h_age + MG_b83*h_italian + MG_b87*h_student + MG_b91*h_lyceum + MG_b95*h_sseximp ///
+ MG_b101 + MG_b110 + MG_b114*h_survey + MG_b121*h_survey + MG_b123*h_survey
gen prob0=normal(x_betahat0)
gen prob1=normal(x_betahat1)
gen diff=prob1-prob0
egen probhat0=mean(prob0)
egen probhat1=mean(prob1)
egen diffhat=mean(diff)
tempname prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi   
_pctile prob0, p(2.5,97.5) 
scalar `lo0' = r(r1)
scalar `hi0' = r(r2)  
_pctile prob1, p(2.5,97.5)
scalar `lo1'= r(r1)
scalar `hi1'= r(r2)  
_pctile diff, p(2.5,97.5)
scalar `diff_lo'= r(r1)
scalar `diff_hi'= r(r2)  
scalar `prob_hat0'=probhat0
scalar `prob_hat1'=probhat1
scalar `diff_hat'=diffhat
post mypost (`prob_hat0') (`lo0') (`hi0') (`prob_hat1') (`lo1') (`hi1') (`diff_hat') (`diff_lo') (`diff_hi')
drop x_betahat0 x_betahat1 prob0 prob1 diff probhat0 probhat1 diffhat 
display ""
postclose mypost
use sim2.dta, clear
append using sim.dta
save sim2.dta, replace
restore, not
**********   EDUCATION * SAMESEX Interaction
* Education: University vs. Middle-junior high (Edu3 vs Edu1) at Same rights (Samesex1) and 'More tax-spend' candidate (Tax1)
estimates use m10_coeEDU.ster
est des
preserve
drawnorm MG_b1-MG_b232, n(10000) means(e(b)) cov(e(V)) clear seed(1)
postutil clear
postfile mypost prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi using sim.dta, replace
noisily display "start"
generate x_betahat0 = MG_b232 + MG_b1
generate x_betahat1 = MG_b232 + MG_b3 ///
+ MG_b17*h_pinterest + MG_b23*h_leftright + MG_b29*h_gender + MG_b35*h_age + MG_b41*h_italian + MG_b47*h_student + MG_b53*h_lyceum + MG_b59*h_eduimp + MG_b115*h_survey
gen prob0=normal(x_betahat0)
gen prob1=normal(x_betahat1)
gen diff=prob1-prob0
egen probhat0=mean(prob0)
egen probhat1=mean(prob1)
egen diffhat=mean(diff)
tempname prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi   
_pctile prob0, p(2.5,97.5) 
scalar `lo0' = r(r1)
scalar `hi0' = r(r2)  
_pctile prob1, p(2.5,97.5)
scalar `lo1'= r(r1)
scalar `hi1'= r(r2)  
_pctile diff, p(2.5,97.5)
scalar `diff_lo'= r(r1)
scalar `diff_hi'= r(r2)  
scalar `prob_hat0'=probhat0
scalar `prob_hat1'=probhat1
scalar `diff_hat'=diffhat
post mypost (`prob_hat0') (`lo0') (`hi0') (`prob_hat1') (`lo1') (`hi1') (`diff_hat') (`diff_lo') (`diff_hi')
drop x_betahat0 x_betahat1 prob0 prob1 diff probhat0 probhat1 diffhat 
display ""
postclose mypost
use sim2.dta, clear
append using sim.dta
save sim2.dta, replace
restore, not
* Education: University vs. Middle-junior high (Edu3 vs Edu1) at Some rights (Samesex2) and 'More tax-spend' candidate (Tax1)
estimates use m10_coeEDU.ster
est des
preserve
drawnorm MG_b1-MG_b232, n(10000) means(e(b)) cov(e(V)) clear seed(1)
postutil clear
postfile mypost prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi using sim.dta, replace
noisily display "start"
generate x_betahat0 = MG_b232 + MG_b1
generate x_betahat1 = MG_b232 + MG_b3 ///
+ MG_b17*h_pinterest + MG_b23*h_leftright + MG_b29*h_gender + MG_b35*h_age + MG_b41*h_italian + MG_b47*h_student + MG_b53*h_lyceum + MG_b59*h_eduimp ///
+ MG_b66*h_pinterest + MG_b70*h_leftright + MG_b74*h_gender + MG_b78*h_age + MG_b82*h_italian + MG_b86*h_student + MG_b90*h_lyceum + MG_b94*h_sseximp ///
+ MG_b112 + MG_b115*h_survey + MG_b122*h_survey
gen prob0=normal(x_betahat0)
gen prob1=normal(x_betahat1)
gen diff=prob1-prob0
egen probhat0=mean(prob0)
egen probhat1=mean(prob1)
egen diffhat=mean(diff)
tempname prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi   
_pctile prob0, p(2.5,97.5) 
scalar `lo0' = r(r1)
scalar `hi0' = r(r2)  
_pctile prob1, p(2.5,97.5)
scalar `lo1'= r(r1)
scalar `hi1'= r(r2)  
_pctile diff, p(2.5,97.5)
scalar `diff_lo'= r(r1)
scalar `diff_hi'= r(r2)  
scalar `prob_hat0'=probhat0
scalar `prob_hat1'=probhat1
scalar `diff_hat'=diffhat
post mypost (`prob_hat0') (`lo0') (`hi0') (`prob_hat1') (`lo1') (`hi1') (`diff_hat') (`diff_lo') (`diff_hi')
drop x_betahat0 x_betahat1 prob0 prob1 diff probhat0 probhat1 diffhat 
display ""
postclose mypost
use sim2.dta, clear
append using sim.dta
save sim2.dta, replace
restore, not
* Education: University vs. Middle-junior high (Edu3 vs Edu1) at No rights (Samesex3)  and 'More tax-spend' candidate (Tax1)
estimates use m10_coeEDU.ster
est des
preserve
drawnorm MG_b1-MG_b232, n(10000) means(e(b)) cov(e(V)) clear seed(1)
postutil clear
postfile mypost prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi using sim.dta, replace
noisily display "start"
generate x_betahat0 = MG_b232 + MG_b1
generate x_betahat1 = MG_b232 + MG_b3 ///
+ MG_b17*h_pinterest + MG_b23*h_leftright + MG_b29*h_gender + MG_b35*h_age + MG_b41*h_italian + MG_b47*h_student + MG_b53*h_lyceum + MG_b59*h_eduimp ///
+ MG_b67*h_pinterest + MG_b71*h_leftright + MG_b75*h_gender + MG_b79*h_age + MG_b83*h_italian + MG_b87*h_student + MG_b91*h_lyceum + MG_b95*h_sseximp ///
+ MG_b113 + MG_b115*h_survey + MG_b123*h_survey
gen prob0=normal(x_betahat0)
gen prob1=normal(x_betahat1)
gen diff=prob1-prob0
egen probhat0=mean(prob0)
egen probhat1=mean(prob1)
egen diffhat=mean(diff)
tempname prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi   
_pctile prob0, p(2.5,97.5) 
scalar `lo0' = r(r1)
scalar `hi0' = r(r2)  
_pctile prob1, p(2.5,97.5)
scalar `lo1'= r(r1)
scalar `hi1'= r(r2)  
_pctile diff, p(2.5,97.5)
scalar `diff_lo'= r(r1)
scalar `diff_hi'= r(r2)  
scalar `prob_hat0'=probhat0
scalar `prob_hat1'=probhat1
scalar `diff_hat'=diffhat
post mypost (`prob_hat0') (`lo0') (`hi0') (`prob_hat1') (`lo1') (`hi1') (`diff_hat') (`diff_lo') (`diff_hi')
drop x_betahat0 x_betahat1 prob0 prob1 diff probhat0 probhat1 diffhat 
display ""
postclose mypost
use sim2.dta, clear
append using sim.dta
save sim2.dta, replace
restore, not
**********   EDUCATION * SAMESEX Interaction
* Education: University vs. Middle-junior high (Edu3 vs Edu1) at Same rights (Samesex1) and 'Keep tax and spend' candidate (Tax2)
estimates use m10_coeEDU.ster
est des
preserve
drawnorm MG_b1-MG_b232, n(10000) means(e(b)) cov(e(V)) clear seed(1)
postutil clear
postfile mypost prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi using sim.dta, replace
noisily display "start"
generate x_betahat0 = MG_b232 + MG_b1
generate x_betahat1 = MG_b232 + MG_b3 ///
+ MG_b17*h_pinterest + MG_b23*h_leftright + MG_b29*h_gender + MG_b35*h_age + MG_b41*h_italian + MG_b47*h_student + MG_b53*h_lyceum + MG_b59*h_eduimp ///
+ MG_b64*h_pinterest + MG_b68*h_leftright + MG_b72*h_gender + MG_b76*h_age + MG_b80*h_italian + MG_b84*h_student + MG_b88*h_lyceum + MG_b92*h_taximp ///
+ MG_b103 + MG_b115*h_survey + MG_b120*h_survey
gen prob0=normal(x_betahat0)
gen prob1=normal(x_betahat1)
gen diff=prob1-prob0
egen probhat0=mean(prob0)
egen probhat1=mean(prob1)
egen diffhat=mean(diff)
tempname prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi   
_pctile prob0, p(2.5,97.5) 
scalar `lo0' = r(r1)
scalar `hi0' = r(r2)  
_pctile prob1, p(2.5,97.5)
scalar `lo1'= r(r1)
scalar `hi1'= r(r2)  
_pctile diff, p(2.5,97.5)
scalar `diff_lo'= r(r1)
scalar `diff_hi'= r(r2)  
scalar `prob_hat0'=probhat0
scalar `prob_hat1'=probhat1
scalar `diff_hat'=diffhat
post mypost (`prob_hat0') (`lo0') (`hi0') (`prob_hat1') (`lo1') (`hi1') (`diff_hat') (`diff_lo') (`diff_hi')
drop x_betahat0 x_betahat1 prob0 prob1 diff probhat0 probhat1 diffhat 
display ""
postclose mypost
use sim2.dta, clear
append using sim.dta
save sim2.dta, replace
restore, not
* Education: University vs. Middle-junior high (Edu3 vs Edu1) at Some rights (Samesex2)  and 'Keep tax and spend' candidate (Tax2)
estimates use m10_coeEDU.ster
est des
preserve
drawnorm MG_b1-MG_b232, n(10000) means(e(b)) cov(e(V)) clear seed(1)
postutil clear
postfile mypost prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi using sim.dta, replace
noisily display "start"
generate x_betahat0 = MG_b232 + MG_b1
generate x_betahat1 = MG_b232 + MG_b3 ///
+ MG_b17*h_pinterest + MG_b23*h_leftright + MG_b29*h_gender + MG_b35*h_age + MG_b41*h_italian + MG_b47*h_student + MG_b53*h_lyceum + MG_b59*h_eduimp ///
+ MG_b64*h_pinterest + MG_b68*h_leftright + MG_b72*h_gender + MG_b76*h_age + MG_b80*h_italian + MG_b84*h_student + MG_b88*h_lyceum + MG_b92*h_taximp ///
+ MG_b66*h_pinterest + MG_b70*h_leftright + MG_b74*h_gender + MG_b78*h_age + MG_b82*h_italian + MG_b86*h_student + MG_b90*h_lyceum + MG_b94*h_sseximp ///
+ MG_b103 + MG_b112 + MG_b115*h_survey + MG_b120*h_survey + MG_b122*h_survey
gen prob0=normal(x_betahat0)
gen prob1=normal(x_betahat1)
gen diff=prob1-prob0
egen probhat0=mean(prob0)
egen probhat1=mean(prob1)
egen diffhat=mean(diff)
tempname prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi   
_pctile prob0, p(2.5,97.5) 
scalar `lo0' = r(r1)
scalar `hi0' = r(r2)  
_pctile prob1, p(2.5,97.5)
scalar `lo1'= r(r1)
scalar `hi1'= r(r2)  
_pctile diff, p(2.5,97.5)
scalar `diff_lo'= r(r1)
scalar `diff_hi'= r(r2)  
scalar `prob_hat0'=probhat0
scalar `prob_hat1'=probhat1
scalar `diff_hat'=diffhat
post mypost (`prob_hat0') (`lo0') (`hi0') (`prob_hat1') (`lo1') (`hi1') (`diff_hat') (`diff_lo') (`diff_hi')
drop x_betahat0 x_betahat1 prob0 prob1 diff probhat0 probhat1 diffhat 
display ""
postclose mypost
use sim2.dta, clear
append using sim.dta
save sim2.dta, replace
restore, not
* Education: University vs. Middle-junior high (Edu3 vs Edu1) at No rights (Samesex3)  and 'Keep tax and spend' candidate (Tax2)
estimates use m10_coeEDU.ster
est des
preserve
drawnorm MG_b1-MG_b232, n(10000) means(e(b)) cov(e(V)) clear seed(1)
postutil clear
postfile mypost prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi using sim.dta, replace
noisily display "start"
generate x_betahat0 = MG_b232 + MG_b1
generate x_betahat1 = MG_b232 + MG_b3 ///
+ MG_b17*h_pinterest + MG_b23*h_leftright + MG_b29*h_gender + MG_b35*h_age + MG_b41*h_italian + MG_b47*h_student + MG_b53*h_lyceum + MG_b59*h_eduimp ///
+ MG_b64*h_pinterest + MG_b68*h_leftright + MG_b72*h_gender + MG_b76*h_age + MG_b80*h_italian + MG_b84*h_student + MG_b88*h_lyceum + MG_b92*h_taximp ///
+ MG_b67*h_pinterest + MG_b71*h_leftright + MG_b75*h_gender + MG_b79*h_age + MG_b83*h_italian + MG_b87*h_student + MG_b91*h_lyceum + MG_b95*h_sseximp ///
+ MG_b103 + MG_b113 + MG_b115*h_survey + MG_b120*h_survey + MG_b123*h_survey
gen prob0=normal(x_betahat0)
gen prob1=normal(x_betahat1)
gen diff=prob1-prob0
egen probhat0=mean(prob0)
egen probhat1=mean(prob1)
egen diffhat=mean(diff)
tempname prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi   
_pctile prob0, p(2.5,97.5) 
scalar `lo0' = r(r1)
scalar `hi0' = r(r2)  
_pctile prob1, p(2.5,97.5)
scalar `lo1'= r(r1)
scalar `hi1'= r(r2)  
_pctile diff, p(2.5,97.5)
scalar `diff_lo'= r(r1)
scalar `diff_hi'= r(r2)  
scalar `prob_hat0'=probhat0
scalar `prob_hat1'=probhat1
scalar `diff_hat'=diffhat
post mypost (`prob_hat0') (`lo0') (`hi0') (`prob_hat1') (`lo1') (`hi1') (`diff_hat') (`diff_lo') (`diff_hi')
drop x_betahat0 x_betahat1 prob0 prob1 diff probhat0 probhat1 diffhat 
display ""
postclose mypost
use sim2.dta, clear
append using sim.dta
save sim2.dta, replace
restore, not
**********   EDUCATION * SAMESEX Interaction
* Education: University vs. Middle-junior high (Edu3 vs Edu1) at Same rights (Samesex1) and 'Cut tax and spend' candidate (Tax3)
estimates use m10_coeEDU.ster
est des
preserve
drawnorm MG_b1-MG_b232, n(10000) means(e(b)) cov(e(V)) clear seed(1)
postutil clear
postfile mypost prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi using sim.dta, replace
noisily display "start"
generate x_betahat0 = MG_b232 + MG_b1
generate x_betahat1 = MG_b232 + MG_b3 ///
+ MG_b17*h_pinterest + MG_b23*h_leftright + MG_b29*h_gender + MG_b35*h_age + MG_b41*h_italian + MG_b47*h_student + MG_b53*h_lyceum + MG_b59*h_eduimp ///
+ MG_b65*h_pinterest + MG_b69*h_leftright + MG_b73*h_gender + MG_b77*h_age + MG_b81*h_italian + MG_b85*h_student + MG_b89*h_lyceum + MG_b93*h_taximp ///
+ MG_b104 + MG_b115*h_survey + MG_b121*h_survey
gen prob0=normal(x_betahat0)
gen prob1=normal(x_betahat1)
gen diff=prob1-prob0
egen probhat0=mean(prob0)
egen probhat1=mean(prob1)
egen diffhat=mean(diff)
tempname prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi   
_pctile prob0, p(2.5,97.5) 
scalar `lo0' = r(r1)
scalar `hi0' = r(r2)  
_pctile prob1, p(2.5,97.5)
scalar `lo1'= r(r1)
scalar `hi1'= r(r2)  
_pctile diff, p(2.5,97.5)
scalar `diff_lo'= r(r1)
scalar `diff_hi'= r(r2)  
scalar `prob_hat0'=probhat0
scalar `prob_hat1'=probhat1
scalar `diff_hat'=diffhat
post mypost (`prob_hat0') (`lo0') (`hi0') (`prob_hat1') (`lo1') (`hi1') (`diff_hat') (`diff_lo') (`diff_hi')
drop x_betahat0 x_betahat1 prob0 prob1 diff probhat0 probhat1 diffhat 
display ""
postclose mypost
use sim2.dta, clear
append using sim.dta
save sim2.dta, replace
restore, not
* Education: University vs. Middle-junior high (Edu3 vs Edu1) at Some rights (Samesex2)  and 'Cut tax and spend' candidate (Tax3)
estimates use m10_coeEDU.ster
est des
preserve
drawnorm MG_b1-MG_b232, n(10000) means(e(b)) cov(e(V)) clear seed(1)
postutil clear
postfile mypost prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi using sim.dta, replace
noisily display "start"
generate x_betahat0 = MG_b232 + MG_b1
generate x_betahat1 = MG_b232 + MG_b3 ///
+ MG_b17*h_pinterest + MG_b23*h_leftright + MG_b29*h_gender + MG_b35*h_age + MG_b41*h_italian + MG_b47*h_student + MG_b53*h_lyceum + MG_b59*h_eduimp ///
+ MG_b65*h_pinterest + MG_b69*h_leftright + MG_b73*h_gender + MG_b77*h_age + MG_b81*h_italian + MG_b85*h_student + MG_b89*h_lyceum + MG_b93*h_taximp ///
+ MG_b66*h_pinterest + MG_b70*h_leftright + MG_b74*h_gender + MG_b78*h_age + MG_b82*h_italian + MG_b86*h_student + MG_b90*h_lyceum + MG_b94*h_sseximp ///
+ MG_b104 + MG_b112 + MG_b115*h_survey + MG_b121*h_survey + MG_b122*h_survey
gen prob0=normal(x_betahat0)
gen prob1=normal(x_betahat1)
gen diff=prob1-prob0
egen probhat0=mean(prob0)
egen probhat1=mean(prob1)
egen diffhat=mean(diff)
tempname prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi   
_pctile prob0, p(2.5,97.5) 
scalar `lo0' = r(r1)
scalar `hi0' = r(r2)  
_pctile prob1, p(2.5,97.5)
scalar `lo1'= r(r1)
scalar `hi1'= r(r2)  
_pctile diff, p(2.5,97.5)
scalar `diff_lo'= r(r1)
scalar `diff_hi'= r(r2)  
scalar `prob_hat0'=probhat0
scalar `prob_hat1'=probhat1
scalar `diff_hat'=diffhat
post mypost (`prob_hat0') (`lo0') (`hi0') (`prob_hat1') (`lo1') (`hi1') (`diff_hat') (`diff_lo') (`diff_hi')
drop x_betahat0 x_betahat1 prob0 prob1 diff probhat0 probhat1 diffhat 
display ""
postclose mypost
use sim2.dta, clear
append using sim.dta
save sim2.dta, replace
restore, not
* Education: University vs. Middle-junior high (Edu3 vs Edu1) at No rights (Samesex3)  and 'Cut tax and spend' candidate (Tax3)
estimates use m10_coeEDU.ster
est des
preserve
drawnorm MG_b1-MG_b232, n(10000) means(e(b)) cov(e(V)) clear seed(1)
postutil clear
postfile mypost prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi using sim.dta, replace
noisily display "start"
generate x_betahat0 = MG_b232 + MG_b1
generate x_betahat1 = MG_b232 + MG_b3 ///
+ MG_b17*h_pinterest + MG_b23*h_leftright + MG_b29*h_gender + MG_b35*h_age + MG_b41*h_italian + MG_b47*h_student + MG_b53*h_lyceum + MG_b59*h_eduimp ///
+ MG_b65*h_pinterest + MG_b69*h_leftright + MG_b73*h_gender + MG_b77*h_age + MG_b81*h_italian + MG_b85*h_student + MG_b89*h_lyceum + MG_b93*h_taximp ///
+ MG_b67*h_pinterest + MG_b71*h_leftright + MG_b75*h_gender + MG_b79*h_age + MG_b83*h_italian + MG_b87*h_student + MG_b91*h_lyceum + MG_b95*h_sseximp ///
+ MG_b104 + MG_b113 + MG_b115*h_survey + MG_b121*h_survey + MG_b123*h_survey
gen prob0=normal(x_betahat0)
gen prob1=normal(x_betahat1)
gen diff=prob1-prob0
egen probhat0=mean(prob0)
egen probhat1=mean(prob1)
egen diffhat=mean(diff)
tempname prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi   
_pctile prob0, p(2.5,97.5) 
scalar `lo0' = r(r1)
scalar `hi0' = r(r2)  
_pctile prob1, p(2.5,97.5)
scalar `lo1'= r(r1)
scalar `hi1'= r(r2)  
_pctile diff, p(2.5,97.5)
scalar `diff_lo'= r(r1)
scalar `diff_hi'= r(r2)  
scalar `prob_hat0'=probhat0
scalar `prob_hat1'=probhat1
scalar `diff_hat'=diffhat
post mypost (`prob_hat0') (`lo0') (`hi0') (`prob_hat1') (`lo1') (`hi1') (`diff_hat') (`diff_lo') (`diff_hi')
drop x_betahat0 x_betahat1 prob0 prob1 diff probhat0 probhat1 diffhat 
display ""
postclose mypost
use sim2.dta, clear
append using sim.dta
save sim2.dta, replace
restore, not
**********   INCOME (TASK NO.1)
* Income: Low (Inc1) 
estimates use m10_coeINC.ster
est des
preserve
drawnorm MG_b1-MG_b232, n(10000) means(e(b)) cov(e(V)) clear seed(1)
postutil clear
postfile mypost prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi using sim.dta, replace
noisily display "start"
generate x_betahat0 = MG_b232 + MG_b4
generate x_betahat1 = MG_b232 + MG_b4
gen prob0=normal(x_betahat0)
gen prob1=normal(x_betahat1)
gen diff=prob1-prob0
egen probhat0=mean(prob0)
egen probhat1=mean(prob1)
egen diffhat=mean(diff)
tempname prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi   
_pctile prob0, p(2.5,97.5) 
scalar `lo0' = r(r1)
scalar `hi0' = r(r2)  
_pctile prob1, p(2.5,97.5)
scalar `lo1'= r(r1)
scalar `hi1'= r(r2)  
_pctile diff, p(2.5,97.5)
scalar `diff_lo'= r(r1)
scalar `diff_hi'= r(r2)  
scalar `prob_hat0'=probhat0
scalar `prob_hat1'=probhat1
scalar `diff_hat'=diffhat
post mypost (`prob_hat0') (`lo0') (`hi0') (`prob_hat1') (`lo1') (`hi1') (`diff_hat') (`diff_lo') (`diff_hi')
drop x_betahat0 x_betahat1 prob0 prob1 diff probhat0 probhat1 diffhat 
display ""
postclose mypost
use sim2.dta, clear
append using sim.dta
save sim2.dta, replace
restore, not
* Income: Middle vs. Low (Inc2 vs Inc1) 
estimates use m10_coeINC.ster
est des
preserve
drawnorm MG_b1-MG_b232, n(10000) means(e(b)) cov(e(V)) clear seed(1)
postutil clear
postfile mypost prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi using sim.dta, replace
noisily display "start"
generate x_betahat0 = MG_b232 + MG_b4
generate x_betahat1 = MG_b232 + MG_b5 + MG_b18*h_pinterest + MG_b24*h_leftright + MG_b30*h_gender + MG_b36*h_age + MG_b42*h_italian + MG_b48*h_student ///
+ MG_b54*h_lyceum + MG_b60*h_incimp + MG_b116*h_survey
gen prob0=normal(x_betahat0)
gen prob1=normal(x_betahat1)
gen diff=prob1-prob0
egen probhat0=mean(prob0)
egen probhat1=mean(prob1)
egen diffhat=mean(diff)
tempname prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi   
_pctile prob0, p(2.5,97.5) 
scalar `lo0' = r(r1)
scalar `hi0' = r(r2)  
_pctile prob1, p(2.5,97.5)
scalar `lo1'= r(r1)
scalar `hi1'= r(r2)  
_pctile diff, p(2.5,97.5)
scalar `diff_lo'= r(r1)
scalar `diff_hi'= r(r2)  
scalar `prob_hat0'=probhat0
scalar `prob_hat1'=probhat1
scalar `diff_hat'=diffhat
post mypost (`prob_hat0') (`lo0') (`hi0') (`prob_hat1') (`lo1') (`hi1') (`diff_hat') (`diff_lo') (`diff_hi')
drop x_betahat0 x_betahat1 prob0 prob1 diff probhat0 probhat1 diffhat 
display ""
postclose mypost
use sim2.dta, clear
append using sim.dta
save sim2.dta, replace
restore, not
* Income: High vs. Low (Inc3 vs Inc1) 
estimates use m10_coeINC.ster
est des
preserve
drawnorm MG_b1-MG_b232, n(10000) means(e(b)) cov(e(V)) clear seed(1)
postutil clear
postfile mypost prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi using sim.dta, replace
noisily display "start"
generate x_betahat0 = MG_b232 + MG_b4
generate x_betahat1 = MG_b232 + MG_b6 + MG_b19*h_pinterest + MG_b25*h_leftright + MG_b31*h_gender + MG_b37*h_age + MG_b43*h_italian + MG_b49*h_student ///
+ MG_b55*h_lyceum + MG_b61*h_incimp + MG_b117*h_survey
gen prob0=normal(x_betahat0)
gen prob1=normal(x_betahat1)
gen diff=prob1-prob0
egen probhat0=mean(prob0)
egen probhat1=mean(prob1)
egen diffhat=mean(diff)
tempname prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi   
_pctile prob0, p(2.5,97.5) 
scalar `lo0' = r(r1)
scalar `hi0' = r(r2)  
_pctile prob1, p(2.5,97.5)
scalar `lo1'= r(r1)
scalar `hi1'= r(r2)  
_pctile diff, p(2.5,97.5)
scalar `diff_lo'= r(r1)
scalar `diff_hi'= r(r2)  
scalar `prob_hat0'=probhat0
scalar `prob_hat1'=probhat1
scalar `diff_hat'=diffhat
post mypost (`prob_hat0') (`lo0') (`hi0') (`prob_hat1') (`lo1') (`hi1') (`diff_hat') (`diff_lo') (`diff_hi')
drop x_betahat0 x_betahat1 prob0 prob1 diff probhat0 probhat1 diffhat 
display ""
postclose mypost
use sim2.dta, clear
append using sim.dta
save sim2.dta, replace
restore, not
**********   CORRUPTION (TASK NO.1)
* Corruption: Clean (Corr1) 
estimates use m10_coeCOR.ster
est des
preserve
drawnorm MG_b1-MG_b232, n(10000) means(e(b)) cov(e(V)) clear seed(1)
postutil clear
postfile mypost prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi using sim.dta, replace
noisily display "start"
generate x_betahat0 = MG_b232 + MG_b7
generate x_betahat1 = MG_b232 + MG_b7
gen prob0=normal(x_betahat0)
gen prob1=normal(x_betahat1)
gen diff=prob1-prob0
egen probhat0=mean(prob0)
egen probhat1=mean(prob1)
egen diffhat=mean(diff)
tempname prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi   
_pctile prob0, p(2.5,97.5) 
scalar `lo0' = r(r1)
scalar `hi0' = r(r2)  
_pctile prob1, p(2.5,97.5)
scalar `lo1'= r(r1)
scalar `hi1'= r(r2)  
_pctile diff, p(2.5,97.5)
scalar `diff_lo'= r(r1)
scalar `diff_hi'= r(r2)  
scalar `prob_hat0'=probhat0
scalar `prob_hat1'=probhat1
scalar `diff_hat'=diffhat
post mypost (`prob_hat0') (`lo0') (`hi0') (`prob_hat1') (`lo1') (`hi1') (`diff_hat') (`diff_lo') (`diff_hi')
drop x_betahat0 x_betahat1 prob0 prob1 diff probhat0 probhat1 diffhat 
display ""
postclose mypost
use sim2.dta, clear
append using sim.dta
save sim2.dta, replace
restore, not
* Corruption: Investigated vs. Clean (Corr2 vs Corr1) 
estimates use m10_coeCOR.ster
est des
preserve
drawnorm MG_b1-MG_b232, n(10000) means(e(b)) cov(e(V)) clear seed(1)
postutil clear
postfile mypost prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi using sim.dta, replace
noisily display "start"
generate x_betahat0 = MG_b232 + MG_b7
generate x_betahat1 = MG_b232 + MG_b8 + MG_b20*h_pinterest + MG_b26*h_leftright + MG_b32*h_gender + MG_b38*h_age + MG_b44*h_italian + MG_b50*h_student ///
+ MG_b56*h_lyceum + MG_b62*h_honimp + MG_b118*h_survey
gen prob0=normal(x_betahat0)
gen prob1=normal(x_betahat1)
gen diff=prob1-prob0
egen probhat0=mean(prob0)
egen probhat1=mean(prob1)
egen diffhat=mean(diff)
tempname prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi   
_pctile prob0, p(2.5,97.5) 
scalar `lo0' = r(r1)
scalar `hi0' = r(r2)  
_pctile prob1, p(2.5,97.5)
scalar `lo1'= r(r1)
scalar `hi1'= r(r2)  
_pctile diff, p(2.5,97.5)
scalar `diff_lo'= r(r1)
scalar `diff_hi'= r(r2)  
scalar `prob_hat0'=probhat0
scalar `prob_hat1'=probhat1
scalar `diff_hat'=diffhat
post mypost (`prob_hat0') (`lo0') (`hi0') (`prob_hat1') (`lo1') (`hi1') (`diff_hat') (`diff_lo') (`diff_hi')
drop x_betahat0 x_betahat1 prob0 prob1 diff probhat0 probhat1 diffhat 
display ""
postclose mypost
use sim2.dta, clear
append using sim.dta
save sim2.dta, replace
restore, not
* Corruption: Corrupt vs. Clean (Corr3 vs Corr1) 
estimates use m10_coeCOR.ster
est des
preserve
drawnorm MG_b1-MG_b232, n(10000) means(e(b)) cov(e(V)) clear seed(1)
postutil clear
postfile mypost prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi using sim.dta, replace
noisily display "start"
generate x_betahat0 = MG_b232 + MG_b7
generate x_betahat1 = MG_b232 + MG_b9 + MG_b21*h_pinterest + MG_b27*h_leftright + MG_b33*h_gender + MG_b39*h_age + MG_b45*h_italian + MG_b51*h_student ///
+ MG_b57*h_lyceum + MG_b63*h_honimp + MG_b119*h_survey
gen prob0=normal(x_betahat0)
gen prob1=normal(x_betahat1)
gen diff=prob1-prob0
egen probhat0=mean(prob0)
egen probhat1=mean(prob1)
egen diffhat=mean(diff)
tempname prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi   
_pctile prob0, p(2.5,97.5) 
scalar `lo0' = r(r1)
scalar `hi0' = r(r2)  
_pctile prob1, p(2.5,97.5)
scalar `lo1'= r(r1)
scalar `hi1'= r(r2)  
_pctile diff, p(2.5,97.5)
scalar `diff_lo'= r(r1)
scalar `diff_hi'= r(r2)  
scalar `prob_hat0'=probhat0
scalar `prob_hat1'=probhat1
scalar `diff_hat'=diffhat
post mypost (`prob_hat0') (`lo0') (`hi0') (`prob_hat1') (`lo1') (`hi1') (`diff_hat') (`diff_lo') (`diff_hi')
drop x_betahat0 x_betahat1 prob0 prob1 diff probhat0 probhat1 diffhat 
display ""
postclose mypost
use sim2.dta, clear
append using sim.dta
save sim2.dta, replace
restore, not

gen MV = _n
eclplot diff_hat diff_hi diff_lo MV, estopts(msize(small)) rplottype(rspike) ciopts(msize(small)) graphregion(fcolor(white)) hor title ("Task No.1", size(2)) ///
ytitle("") ysca(noline) ylabel(0.5 " " 1 "Junior high school" 2 "High school" 3 "High school" 4 "High school" 5 "High school" 6 "High school" 7 "High school" ///
8 "High school" 9 "High school"  10 "High school" 11 "University" 12 "University" 13 "University" 14 "University" 15 "University" 16 "University" ///
17 "University" 18 "University"  19 "University" 20 "Low" 21 "Middle" 22 "High" 23 "Clean" 24 "Investigated" 25 "Corrupt", noticks labsize(2)) ///
xtitle("") xlabel(-0.8 "-.8" -0.6 "-.6" -0.4 "-.4" -0.2 "-.2" 0 "0" 0.2 ".2" 0.4 ".4", noticks labsize(2)) xline(0, lpattern(dot) lcolor(black) lwidth(medthin)) ///
text(0.5 -1 "{bf:Education}", place(w) just(center) size(2)) text(1.5 0 "{it:More tax-spend}", place(c) just(center) size(2)) ///
text(1.5 -1 "Same rights", place(w) just(center) size(2)) text(2.5 -1 "Some rights", place(w) just(center) size(2)) text(3.5 -1 "No rights", place(w) just(center) size(2)) ///
text(4.5 0 "{it:Mantain tax-spend}", place(c) just(center) size(2)) ///
text(4.5 -1 "Same rights", place(w) just(center) size(2)) text(5.5 -1 "Some rights", place(w) just(center) size(2)) text(6.5 -1 "No rights", place(w) just(center) size(2)) ///
text(7.5 0 "{it:Less tax-spend}", place(c) just(center) size(2)) ///
text(7.5 -1 "Same rights", place(w) just(center) size(2)) text(8.5 -1 "Some rights", place(w) just(center) size(2)) text(9.5 -1 "No rights", place(w) just(center) size(2)) ///
text(10.5 0 "{it:More tax-spend}", place(c) just(center) size(2)) ///
text(10.5 -1 "Same rights", place(w) just(center) size(2)) text(11.5 -1 "Some rights", place(w) just(center) size(2)) text(12.5 -1 "No rights", place(w) just(center) size(2)) ///
text(13.5 0 "{it:Mantain tax-spend}", place(c) just(center) size(2)) ///
text(13.5 -1 "Same rights", place(w) just(center) size(2)) text(14.5 -1 "Some rights", place(w) just(center) size(2)) text(15.5 -1 "No rights", place(w) just(center) size(2)) ///
text(16.5 0 "{it:Less tax-spend}:", place(c) just(center) size(2)) ///
text(16.5 -1 "Same rights", place(w) just(center) size(2)) text(17.5 -1 "Some rights", place(w) just(center) size(2)) text(18.5 -1 "No rights", place(w) just(center) size(2)) ///
text(19.5 -1 "{bf:Income}", place(w) just(center) size(2)) ///
text(22.5 -1 "{bf:Integrity}", place(w) just(center) size(2)) saving(COE_1, replace)

**************************************************  TASK NO.14
**********   EDUCATION (TASK NO.14)
* Education: Junior High (Edu1) at Same rights (Samesex1) and 'More tax-spend' candidate (Tax1)
estimates use m10_coeEDU.ster
est des
preserve
drawnorm MG_b1-MG_b232, n(10000) means(e(b)) cov(e(V)) clear seed(1)
postutil clear
postfile mypost prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi using sim.dta, replace
noisily display "start"
generate x_betahat0 = MG_b137 + MG_b232 + MG_b1
generate x_betahat1 = MG_b137 + MG_b232 + MG_b1
gen prob0=normal(x_betahat0)
gen prob1=normal(x_betahat1)
gen diff=prob1-prob0
egen probhat0=mean(prob0)
egen probhat1=mean(prob1)
egen diffhat=mean(diff)
tempname prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi   
_pctile prob0, p(2.5,97.5) 
scalar `lo0' = r(r1)
scalar `hi0' = r(r2)  
_pctile prob1, p(2.5,97.5)
scalar `lo1'= r(r1)
scalar `hi1'= r(r2)  
_pctile diff, p(2.5,97.5)
scalar `diff_lo'= r(r1)
scalar `diff_hi'= r(r2)  
scalar `prob_hat0'=probhat0
scalar `prob_hat1'=probhat1
scalar `diff_hat'=diffhat
post mypost (`prob_hat0') (`lo0') (`hi0') (`prob_hat1') (`lo1') (`hi1') (`diff_hat') (`diff_lo') (`diff_hi')
drop x_betahat0 x_betahat1 prob0 prob1 diff probhat0 probhat1 diffhat 
display ""
postclose mypost
use sim.dta, clear
save sim2.dta, replace
restore, not
**********   EDUCATION * SAMESEX Interaction
* Education: High school vs. Middle-junior high (Edu2 vs Edu1) at Same rights (Samesex1) and 'More tax-spend' candidate (Tax1)
estimates use m10_coeEDU.ster
est des
preserve
drawnorm MG_b1-MG_b232, n(10000) means(e(b)) cov(e(V)) clear seed(1)
postutil clear
postfile mypost prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi using sim.dta, replace
noisily display "start"
generate x_betahat0 = MG_b137 + MG_b232 + MG_b1
generate x_betahat1 = MG_b137 + MG_b232 + MG_b2 + MG_b191 ///
+ MG_b16*h_pinterest + MG_b22*h_leftright + MG_b28*h_gender + MG_b34*h_age + MG_b40*h_italian + MG_b46*h_student + MG_b52*h_lyceum + MG_b58*h_eduimp + MG_b114*h_survey
gen prob0=normal(x_betahat0)
gen prob1=normal(x_betahat1)
gen diff=prob1-prob0
egen probhat0=mean(prob0)
egen probhat1=mean(prob1)
egen diffhat=mean(diff)
tempname prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi   
_pctile prob0, p(2.5,97.5) 
scalar `lo0' = r(r1)
scalar `hi0' = r(r2)  
_pctile prob1, p(2.5,97.5)
scalar `lo1'= r(r1)
scalar `hi1'= r(r2)  
_pctile diff, p(2.5,97.5)
scalar `diff_lo'= r(r1)
scalar `diff_hi'= r(r2)  
scalar `prob_hat0'=probhat0
scalar `prob_hat1'=probhat1
scalar `diff_hat'=diffhat
post mypost (`prob_hat0') (`lo0') (`hi0') (`prob_hat1') (`lo1') (`hi1') (`diff_hat') (`diff_lo') (`diff_hi')
drop x_betahat0 x_betahat1 prob0 prob1 diff probhat0 probhat1 diffhat 
display ""
postclose mypost
use sim2.dta, clear
append using sim.dta
save sim2.dta, replace
restore, not
* Education: High school vs. Middle-junior high (Edu2 vs Edu1) at Some rights (Samesex2) and 'More tax-spend' candidate (Tax1)
estimates use m10_coeEDU.ster
est des
preserve
drawnorm MG_b1-MG_b232, n(10000) means(e(b)) cov(e(V)) clear seed(1)
postutil clear
postfile mypost prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi using sim.dta, replace
noisily display "start"
generate x_betahat0 = MG_b137 + MG_b232 + MG_b1
generate x_betahat1 = MG_b137 + MG_b232 + MG_b2 + MG_b191 ///
+ MG_b16*h_pinterest + MG_b22*h_leftright + MG_b28*h_gender + MG_b34*h_age + MG_b40*h_italian + MG_b46*h_student + MG_b52*h_lyceum + MG_b58*h_eduimp ///
+ MG_b66*h_pinterest + MG_b70*h_leftright + MG_b74*h_gender + MG_b78*h_age + MG_b82*h_italian + MG_b86*h_student + MG_b90*h_lyceum + MG_b94*h_sseximp ///
+ MG_b109 + MG_b114*h_survey + MG_b122*h_survey
gen prob0=normal(x_betahat0)
gen prob1=normal(x_betahat1)
gen diff=prob1-prob0
egen probhat0=mean(prob0)
egen probhat1=mean(prob1)
egen diffhat=mean(diff)
tempname prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi   
_pctile prob0, p(2.5,97.5) 
scalar `lo0' = r(r1)
scalar `hi0' = r(r2)  
_pctile prob1, p(2.5,97.5)
scalar `lo1'= r(r1)
scalar `hi1'= r(r2)  
_pctile diff, p(2.5,97.5)
scalar `diff_lo'= r(r1)
scalar `diff_hi'= r(r2)  
scalar `prob_hat0'=probhat0
scalar `prob_hat1'=probhat1
scalar `diff_hat'=diffhat
post mypost (`prob_hat0') (`lo0') (`hi0') (`prob_hat1') (`lo1') (`hi1') (`diff_hat') (`diff_lo') (`diff_hi')
drop x_betahat0 x_betahat1 prob0 prob1 diff probhat0 probhat1 diffhat 
display ""
postclose mypost
use sim2.dta, clear
append using sim.dta
save sim2.dta, replace
restore, not
* Education: High school vs. Middle-junior high (Edu2 vs Edu1) at No rights (Samesex3) and 'More tax-spend' candidate (Tax1)
estimates use m10_coeEDU.ster
est des
preserve
drawnorm MG_b1-MG_b232, n(10000) means(e(b)) cov(e(V)) clear seed(1)
postutil clear
postfile mypost prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi using sim.dta, replace
noisily display "start"
generate x_betahat0 = MG_b137 + MG_b232 + MG_b1
generate x_betahat1 = MG_b137 + MG_b232 + MG_b2 + MG_b191 ///
+ MG_b16*h_pinterest + MG_b22*h_leftright + MG_b28*h_gender + MG_b34*h_age + MG_b40*h_italian + MG_b46*h_student + MG_b52*h_lyceum + MG_b58*h_eduimp ///
+ MG_b67*h_pinterest + MG_b71*h_leftright + MG_b75*h_gender + MG_b79*h_age + MG_b83*h_italian + MG_b87*h_student + MG_b91*h_lyceum + MG_b95*h_sseximp ///
+ MG_b110 + MG_b114*h_survey + MG_b123*h_survey
gen prob0=normal(x_betahat0)
gen prob1=normal(x_betahat1)
gen diff=prob1-prob0
egen probhat0=mean(prob0)
egen probhat1=mean(prob1)
egen diffhat=mean(diff)
tempname prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi   
_pctile prob0, p(2.5,97.5) 
scalar `lo0' = r(r1)
scalar `hi0' = r(r2)  
_pctile prob1, p(2.5,97.5)
scalar `lo1'= r(r1)
scalar `hi1'= r(r2)  
_pctile diff, p(2.5,97.5)
scalar `diff_lo'= r(r1)
scalar `diff_hi'= r(r2)  
scalar `prob_hat0'=probhat0
scalar `prob_hat1'=probhat1
scalar `diff_hat'=diffhat
post mypost (`prob_hat0') (`lo0') (`hi0') (`prob_hat1') (`lo1') (`hi1') (`diff_hat') (`diff_lo') (`diff_hi')
drop x_betahat0 x_betahat1 prob0 prob1 diff probhat0 probhat1 diffhat 
display ""
postclose mypost
use sim2.dta, clear
append using sim.dta
save sim2.dta, replace
restore, not
**********   EDUCATION * SAMESEX Interaction
* Education: High school vs. Middle-junior high (Edu2 vs Edu1) at Same rights (Samesex1) and 'Keep tax and spend' candidate (Tax2)
estimates use m10_coeEDU.ster
est des
preserve
drawnorm MG_b1-MG_b232, n(10000) means(e(b)) cov(e(V)) clear seed(1)
postutil clear
postfile mypost prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi using sim.dta, replace
noisily display "start"
generate x_betahat0 = MG_b137 + MG_b232 + MG_b1
generate x_betahat1 = MG_b137 + MG_b232 + MG_b2 + MG_b191 ///
+ MG_b16*h_pinterest + MG_b22*h_leftright + MG_b28*h_gender + MG_b34*h_age + MG_b40*h_italian + MG_b46*h_student + MG_b52*h_lyceum + MG_b58*h_eduimp ///
+ MG_b64*h_pinterest + MG_b68*h_leftright + MG_b72*h_gender + MG_b76*h_age + MG_b80*h_italian + MG_b84*h_student + MG_b88*h_lyceum + MG_b92*h_taximp ///
+ MG_b100 + MG_b114*h_survey + MG_b120*h_survey
gen prob0=normal(x_betahat0)
gen prob1=normal(x_betahat1)
gen diff=prob1-prob0
egen probhat0=mean(prob0)
egen probhat1=mean(prob1)
egen diffhat=mean(diff)
tempname prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi   
_pctile prob0, p(2.5,97.5) 
scalar `lo0' = r(r1)
scalar `hi0' = r(r2)  
_pctile prob1, p(2.5,97.5)
scalar `lo1'= r(r1)
scalar `hi1'= r(r2)  
_pctile diff, p(2.5,97.5)
scalar `diff_lo'= r(r1)
scalar `diff_hi'= r(r2)  
scalar `prob_hat0'=probhat0
scalar `prob_hat1'=probhat1
scalar `diff_hat'=diffhat
post mypost (`prob_hat0') (`lo0') (`hi0') (`prob_hat1') (`lo1') (`hi1') (`diff_hat') (`diff_lo') (`diff_hi')
drop x_betahat0 x_betahat1 prob0 prob1 diff probhat0 probhat1 diffhat 
display ""
postclose mypost
use sim2.dta, clear
append using sim.dta
save sim2.dta, replace
restore, not
* Education: High school vs. Middle-junior high (Edu2 vs Edu1) at Some rights (Samesex2) and 'Keep tax and spend' candidate (Tax2)
estimates use m10_coeEDU.ster
est des
preserve
drawnorm MG_b1-MG_b232, n(10000) means(e(b)) cov(e(V)) clear seed(1)
postutil clear
postfile mypost prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi using sim.dta, replace
noisily display "start"
generate x_betahat0 = MG_b137 + MG_b232 + MG_b1
generate x_betahat1 = MG_b137 + MG_b232 + MG_b2 + MG_b191 ///
+ MG_b16*h_pinterest + MG_b22*h_leftright + MG_b28*h_gender + MG_b34*h_age + MG_b40*h_italian + MG_b46*h_student + MG_b52*h_lyceum + MG_b58*h_eduimp ///
+ MG_b64*h_pinterest + MG_b68*h_leftright + MG_b72*h_gender + MG_b76*h_age + MG_b80*h_italian + MG_b84*h_student + MG_b88*h_lyceum + MG_b92*h_taximp ///
+ MG_b66*h_pinterest + MG_b70*h_leftright + MG_b74*h_gender + MG_b78*h_age + MG_b82*h_italian + MG_b86*h_student + MG_b90*h_lyceum + MG_b94*h_sseximp ///
+ MG_b100 + MG_b109 + MG_b114*h_survey + MG_b120*h_survey + MG_b122*h_survey
gen prob0=normal(x_betahat0)
gen prob1=normal(x_betahat1)
gen diff=prob1-prob0
egen probhat0=mean(prob0)
egen probhat1=mean(prob1)
egen diffhat=mean(diff)
tempname prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi   
_pctile prob0, p(2.5,97.5) 
scalar `lo0' = r(r1)
scalar `hi0' = r(r2)  
_pctile prob1, p(2.5,97.5)
scalar `lo1'= r(r1)
scalar `hi1'= r(r2)  
_pctile diff, p(2.5,97.5)
scalar `diff_lo'= r(r1)
scalar `diff_hi'= r(r2)  
scalar `prob_hat0'=probhat0
scalar `prob_hat1'=probhat1
scalar `diff_hat'=diffhat
post mypost (`prob_hat0') (`lo0') (`hi0') (`prob_hat1') (`lo1') (`hi1') (`diff_hat') (`diff_lo') (`diff_hi')
drop x_betahat0 x_betahat1 prob0 prob1 diff probhat0 probhat1 diffhat 
display ""
postclose mypost
use sim2.dta, clear
append using sim.dta
save sim2.dta, replace
restore, not
* Education: High school vs. Middle-junior high (Edu2 vs Edu1) at No rights (Samesex3) and 'Keep tax and spend' candidate (Tax2)
estimates use m10_coeEDU.ster
est des
preserve
drawnorm MG_b1-MG_b232, n(10000) means(e(b)) cov(e(V)) clear seed(1)
postutil clear
postfile mypost prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi using sim.dta, replace
noisily display "start"
generate x_betahat0 = MG_b137 + MG_b232 + MG_b1
generate x_betahat1 = MG_b137 + MG_b232 + MG_b2 + MG_b191 ///
+ MG_b16*h_pinterest + MG_b22*h_leftright + MG_b28*h_gender + MG_b34*h_age + MG_b40*h_italian + MG_b46*h_student + MG_b52*h_lyceum + MG_b58*h_eduimp ///
+ MG_b64*h_pinterest + MG_b68*h_leftright + MG_b72*h_gender + MG_b76*h_age + MG_b80*h_italian + MG_b84*h_student + MG_b88*h_lyceum + MG_b92*h_taximp ///
+ MG_b67*h_pinterest + MG_b71*h_leftright + MG_b75*h_gender + MG_b79*h_age + MG_b83*h_italian + MG_b87*h_student + MG_b91*h_lyceum + MG_b95*h_sseximp ///
+ MG_b100 + MG_b110 + MG_b114*h_survey + MG_b120*h_survey + MG_b123*h_survey
gen prob0=normal(x_betahat0)
gen prob1=normal(x_betahat1)
gen diff=prob1-prob0
egen probhat0=mean(prob0)
egen probhat1=mean(prob1)
egen diffhat=mean(diff)
tempname prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi   
_pctile prob0, p(2.5,97.5) 
scalar `lo0' = r(r1)
scalar `hi0' = r(r2)  
_pctile prob1, p(2.5,97.5)
scalar `lo1'= r(r1)
scalar `hi1'= r(r2)  
_pctile diff, p(2.5,97.5)
scalar `diff_lo'= r(r1)
scalar `diff_hi'= r(r2)  
scalar `prob_hat0'=probhat0
scalar `prob_hat1'=probhat1
scalar `diff_hat'=diffhat
post mypost (`prob_hat0') (`lo0') (`hi0') (`prob_hat1') (`lo1') (`hi1') (`diff_hat') (`diff_lo') (`diff_hi')
drop x_betahat0 x_betahat1 prob0 prob1 diff probhat0 probhat1 diffhat 
display ""
postclose mypost
use sim2.dta, clear
append using sim.dta
save sim2.dta, replace
restore, not
**********   EDUCATION * SAMESEX Interaction
* Education: High school vs. Middle-junior high (Edu2 vs Edu1) at Same rights (Samesex1) and 'Cut tax and spend' candidate (Tax3)
estimates use m10_coeEDU.ster
est des
preserve
drawnorm MG_b1-MG_b232, n(10000) means(e(b)) cov(e(V)) clear seed(1)
postutil clear
postfile mypost prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi using sim.dta, replace
noisily display "start"
generate x_betahat0 = MG_b137 + MG_b232 + MG_b1
generate x_betahat1 = MG_b137 + MG_b232 + MG_b2 + MG_b191 ///
+ MG_b16*h_pinterest + MG_b22*h_leftright + MG_b28*h_gender + MG_b34*h_age + MG_b40*h_italian + MG_b46*h_student + MG_b52*h_lyceum + MG_b58*h_eduimp ///
+ MG_b65*h_pinterest + MG_b69*h_leftright + MG_b73*h_gender + MG_b77*h_age + MG_b81*h_italian + MG_b85*h_student + MG_b89*h_lyceum + MG_b93*h_taximp ///
+ MG_b101 + MG_b114*h_survey + MG_b121*h_survey
gen prob0=normal(x_betahat0)
gen prob1=normal(x_betahat1)
gen diff=prob1-prob0
egen probhat0=mean(prob0)
egen probhat1=mean(prob1)
egen diffhat=mean(diff)
tempname prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi   
_pctile prob0, p(2.5,97.5) 
scalar `lo0' = r(r1)
scalar `hi0' = r(r2)  
_pctile prob1, p(2.5,97.5)
scalar `lo1'= r(r1)
scalar `hi1'= r(r2)  
_pctile diff, p(2.5,97.5)
scalar `diff_lo'= r(r1)
scalar `diff_hi'= r(r2)  
scalar `prob_hat0'=probhat0
scalar `prob_hat1'=probhat1
scalar `diff_hat'=diffhat
post mypost (`prob_hat0') (`lo0') (`hi0') (`prob_hat1') (`lo1') (`hi1') (`diff_hat') (`diff_lo') (`diff_hi')
drop x_betahat0 x_betahat1 prob0 prob1 diff probhat0 probhat1 diffhat 
display ""
postclose mypost
use sim2.dta, clear
append using sim.dta
save sim2.dta, replace
restore, not
* Education: High school vs. Middle-junior high (Edu2 vs Edu1) at Some rights (Samesex2) and 'Cut tax and spend' candidate (Tax3)
estimates use m10_coeEDU.ster
est des
preserve
drawnorm MG_b1-MG_b232, n(10000) means(e(b)) cov(e(V)) clear seed(1)
postutil clear
postfile mypost prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi using sim.dta, replace
noisily display "start"
generate x_betahat0 = MG_b137 + MG_b232 + MG_b1
generate x_betahat1 = MG_b137 + MG_b232 + MG_b2 + MG_b191 ///
+ MG_b16*h_pinterest + MG_b22*h_leftright + MG_b28*h_gender + MG_b34*h_age + MG_b40*h_italian + MG_b46*h_student + MG_b52*h_lyceum + MG_b58*h_eduimp ///
+ MG_b65*h_pinterest + MG_b69*h_leftright + MG_b73*h_gender + MG_b77*h_age + MG_b81*h_italian + MG_b85*h_student + MG_b89*h_lyceum + MG_b93*h_taximp ///
+ MG_b66*h_pinterest + MG_b70*h_leftright + MG_b74*h_gender + MG_b78*h_age + MG_b82*h_italian + MG_b86*h_student + MG_b90*h_lyceum + MG_b94*h_sseximp ///
+ MG_b101 + MG_b109 + MG_b114*h_survey + MG_b121*h_survey + MG_b122*h_survey
gen prob0=normal(x_betahat0)
gen prob1=normal(x_betahat1)
gen diff=prob1-prob0
egen probhat0=mean(prob0)
egen probhat1=mean(prob1)
egen diffhat=mean(diff)
tempname prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi   
_pctile prob0, p(2.5,97.5) 
scalar `lo0' = r(r1)
scalar `hi0' = r(r2)  
_pctile prob1, p(2.5,97.5)
scalar `lo1'= r(r1)
scalar `hi1'= r(r2)  
_pctile diff, p(2.5,97.5)
scalar `diff_lo'= r(r1)
scalar `diff_hi'= r(r2)  
scalar `prob_hat0'=probhat0
scalar `prob_hat1'=probhat1
scalar `diff_hat'=diffhat
post mypost (`prob_hat0') (`lo0') (`hi0') (`prob_hat1') (`lo1') (`hi1') (`diff_hat') (`diff_lo') (`diff_hi')
drop x_betahat0 x_betahat1 prob0 prob1 diff probhat0 probhat1 diffhat 
display ""
postclose mypost
use sim2.dta, clear
append using sim.dta
save sim2.dta, replace
restore, not
* Education: High school vs. Middle-junior high (Edu2 vs Edu1) at No rights (Samesex3)  and 'Cut tax and spend' candidate (Tax3)
estimates use m10_coeEDU.ster
est des
preserve
drawnorm MG_b1-MG_b232, n(10000) means(e(b)) cov(e(V)) clear seed(1)
postutil clear
postfile mypost prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi using sim.dta, replace
noisily display "start"
generate x_betahat0 = MG_b137 + MG_b232 + MG_b1
generate x_betahat1 = MG_b137 + MG_b232 + MG_b2 + MG_b191 ///
+ MG_b16*h_pinterest + MG_b22*h_leftright + MG_b28*h_gender + MG_b34*h_age + MG_b40*h_italian + MG_b46*h_student + MG_b52*h_lyceum + MG_b58*h_eduimp ///
+ MG_b65*h_pinterest + MG_b69*h_leftright + MG_b73*h_gender + MG_b77*h_age + MG_b81*h_italian + MG_b85*h_student + MG_b89*h_lyceum + MG_b93*h_taximp ///
+ MG_b67*h_pinterest + MG_b71*h_leftright + MG_b75*h_gender + MG_b79*h_age + MG_b83*h_italian + MG_b87*h_student + MG_b91*h_lyceum + MG_b95*h_sseximp ///
+ MG_b101 + MG_b110 + MG_b114*h_survey + MG_b121*h_survey + MG_b123*h_survey
gen prob0=normal(x_betahat0)
gen prob1=normal(x_betahat1)
gen diff=prob1-prob0
egen probhat0=mean(prob0)
egen probhat1=mean(prob1)
egen diffhat=mean(diff)
tempname prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi   
_pctile prob0, p(2.5,97.5) 
scalar `lo0' = r(r1)
scalar `hi0' = r(r2)  
_pctile prob1, p(2.5,97.5)
scalar `lo1'= r(r1)
scalar `hi1'= r(r2)  
_pctile diff, p(2.5,97.5)
scalar `diff_lo'= r(r1)
scalar `diff_hi'= r(r2)  
scalar `prob_hat0'=probhat0
scalar `prob_hat1'=probhat1
scalar `diff_hat'=diffhat
post mypost (`prob_hat0') (`lo0') (`hi0') (`prob_hat1') (`lo1') (`hi1') (`diff_hat') (`diff_lo') (`diff_hi')
drop x_betahat0 x_betahat1 prob0 prob1 diff probhat0 probhat1 diffhat 
display ""
postclose mypost
use sim2.dta, clear
append using sim.dta
save sim2.dta, replace
restore, not
**********   EDUCATION * SAMESEX Interaction
* Education: University vs. Middle-junior high (Edu3 vs Edu1) at Same rights (Samesex1) and 'More tax-spend' candidate (Tax1)
estimates use m10_coeEDU.ster
est des
preserve
drawnorm MG_b1-MG_b232, n(10000) means(e(b)) cov(e(V)) clear seed(1)
postutil clear
postfile mypost prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi using sim.dta, replace
noisily display "start"
generate x_betahat0 = MG_b137 + MG_b232 + MG_b1
generate x_betahat1 = MG_b137 + MG_b232 + MG_b3 + MG_b218 ///
+ MG_b17*h_pinterest + MG_b23*h_leftright + MG_b29*h_gender + MG_b35*h_age + MG_b41*h_italian + MG_b47*h_student + MG_b53*h_lyceum + MG_b59*h_eduimp + MG_b115*h_survey
gen prob0=normal(x_betahat0)
gen prob1=normal(x_betahat1)
gen diff=prob1-prob0
egen probhat0=mean(prob0)
egen probhat1=mean(prob1)
egen diffhat=mean(diff)
tempname prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi   
_pctile prob0, p(2.5,97.5) 
scalar `lo0' = r(r1)
scalar `hi0' = r(r2)  
_pctile prob1, p(2.5,97.5)
scalar `lo1'= r(r1)
scalar `hi1'= r(r2)  
_pctile diff, p(2.5,97.5)
scalar `diff_lo'= r(r1)
scalar `diff_hi'= r(r2)  
scalar `prob_hat0'=probhat0
scalar `prob_hat1'=probhat1
scalar `diff_hat'=diffhat
post mypost (`prob_hat0') (`lo0') (`hi0') (`prob_hat1') (`lo1') (`hi1') (`diff_hat') (`diff_lo') (`diff_hi')
drop x_betahat0 x_betahat1 prob0 prob1 diff probhat0 probhat1 diffhat 
display ""
postclose mypost
use sim2.dta, clear
append using sim.dta
save sim2.dta, replace
restore, not
* Education: University vs. Middle-junior high (Edu3 vs Edu1) at Some rights (Samesex2) and 'More tax-spend' candidate (Tax1)
estimates use m10_coeEDU.ster
est des
preserve
drawnorm MG_b1-MG_b232, n(10000) means(e(b)) cov(e(V)) clear seed(1)
postutil clear
postfile mypost prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi using sim.dta, replace
noisily display "start"
generate x_betahat0 = MG_b137 + MG_b232 + MG_b1
generate x_betahat1 = MG_b137 + MG_b232 + MG_b3 + MG_b218 ///
+ MG_b17*h_pinterest + MG_b23*h_leftright + MG_b29*h_gender + MG_b35*h_age + MG_b41*h_italian + MG_b47*h_student + MG_b53*h_lyceum + MG_b59*h_eduimp ///
+ MG_b66*h_pinterest + MG_b70*h_leftright + MG_b74*h_gender + MG_b78*h_age + MG_b82*h_italian + MG_b86*h_student + MG_b90*h_lyceum + MG_b94*h_sseximp ///
+ MG_b112 + MG_b115*h_survey + MG_b122*h_survey
gen prob0=normal(x_betahat0)
gen prob1=normal(x_betahat1)
gen diff=prob1-prob0
egen probhat0=mean(prob0)
egen probhat1=mean(prob1)
egen diffhat=mean(diff)
tempname prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi   
_pctile prob0, p(2.5,97.5) 
scalar `lo0' = r(r1)
scalar `hi0' = r(r2)  
_pctile prob1, p(2.5,97.5)
scalar `lo1'= r(r1)
scalar `hi1'= r(r2)  
_pctile diff, p(2.5,97.5)
scalar `diff_lo'= r(r1)
scalar `diff_hi'= r(r2)  
scalar `prob_hat0'=probhat0
scalar `prob_hat1'=probhat1
scalar `diff_hat'=diffhat
post mypost (`prob_hat0') (`lo0') (`hi0') (`prob_hat1') (`lo1') (`hi1') (`diff_hat') (`diff_lo') (`diff_hi')
drop x_betahat0 x_betahat1 prob0 prob1 diff probhat0 probhat1 diffhat 
display ""
postclose mypost
use sim2.dta, clear
append using sim.dta
save sim2.dta, replace
restore, not
* Education: University vs. Middle-junior high (Edu3 vs Edu1) at No rights (Samesex3)  and 'More tax-spend' candidate (Tax1)
estimates use m10_coeEDU.ster
est des
preserve
drawnorm MG_b1-MG_b232, n(10000) means(e(b)) cov(e(V)) clear seed(1)
postutil clear
postfile mypost prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi using sim.dta, replace
noisily display "start"
generate x_betahat0 = MG_b137 + MG_b232 + MG_b1
generate x_betahat1 = MG_b137 + MG_b232 + MG_b3 + MG_b218 ///
+ MG_b17*h_pinterest + MG_b23*h_leftright + MG_b29*h_gender + MG_b35*h_age + MG_b41*h_italian + MG_b47*h_student + MG_b53*h_lyceum + MG_b59*h_eduimp ///
+ MG_b67*h_pinterest + MG_b71*h_leftright + MG_b75*h_gender + MG_b79*h_age + MG_b83*h_italian + MG_b87*h_student + MG_b91*h_lyceum + MG_b95*h_sseximp ///
+ MG_b113 + MG_b115*h_survey + MG_b123*h_survey
gen prob0=normal(x_betahat0)
gen prob1=normal(x_betahat1)
gen diff=prob1-prob0
egen probhat0=mean(prob0)
egen probhat1=mean(prob1)
egen diffhat=mean(diff)
tempname prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi   
_pctile prob0, p(2.5,97.5) 
scalar `lo0' = r(r1)
scalar `hi0' = r(r2)  
_pctile prob1, p(2.5,97.5)
scalar `lo1'= r(r1)
scalar `hi1'= r(r2)  
_pctile diff, p(2.5,97.5)
scalar `diff_lo'= r(r1)
scalar `diff_hi'= r(r2)  
scalar `prob_hat0'=probhat0
scalar `prob_hat1'=probhat1
scalar `diff_hat'=diffhat
post mypost (`prob_hat0') (`lo0') (`hi0') (`prob_hat1') (`lo1') (`hi1') (`diff_hat') (`diff_lo') (`diff_hi')
drop x_betahat0 x_betahat1 prob0 prob1 diff probhat0 probhat1 diffhat 
display ""
postclose mypost
use sim2.dta, clear
append using sim.dta
save sim2.dta, replace
restore, not
**********   EDUCATION * SAMESEX Interaction
* Education: University vs. Middle-junior high (Edu3 vs Edu1) at Same rights (Samesex1) and 'Keep tax and spend' candidate (Tax2)
estimates use m10_coeEDU.ster
est des
preserve
drawnorm MG_b1-MG_b232, n(10000) means(e(b)) cov(e(V)) clear seed(1)
postutil clear
postfile mypost prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi using sim.dta, replace
noisily display "start"
generate x_betahat0 = MG_b137 + MG_b232 + MG_b1
generate x_betahat1 = MG_b137 + MG_b232 + MG_b3 + MG_b218 ///
+ MG_b17*h_pinterest + MG_b23*h_leftright + MG_b29*h_gender + MG_b35*h_age + MG_b41*h_italian + MG_b47*h_student + MG_b53*h_lyceum + MG_b59*h_eduimp ///
+ MG_b64*h_pinterest + MG_b68*h_leftright + MG_b72*h_gender + MG_b76*h_age + MG_b80*h_italian + MG_b84*h_student + MG_b88*h_lyceum + MG_b92*h_taximp ///
+ MG_b103 + MG_b115*h_survey + MG_b120*h_survey
gen prob0=normal(x_betahat0)
gen prob1=normal(x_betahat1)
gen diff=prob1-prob0
egen probhat0=mean(prob0)
egen probhat1=mean(prob1)
egen diffhat=mean(diff)
tempname prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi   
_pctile prob0, p(2.5,97.5) 
scalar `lo0' = r(r1)
scalar `hi0' = r(r2)  
_pctile prob1, p(2.5,97.5)
scalar `lo1'= r(r1)
scalar `hi1'= r(r2)  
_pctile diff, p(2.5,97.5)
scalar `diff_lo'= r(r1)
scalar `diff_hi'= r(r2)  
scalar `prob_hat0'=probhat0
scalar `prob_hat1'=probhat1
scalar `diff_hat'=diffhat
post mypost (`prob_hat0') (`lo0') (`hi0') (`prob_hat1') (`lo1') (`hi1') (`diff_hat') (`diff_lo') (`diff_hi')
drop x_betahat0 x_betahat1 prob0 prob1 diff probhat0 probhat1 diffhat 
display ""
postclose mypost
use sim2.dta, clear
append using sim.dta
save sim2.dta, replace
restore, not
* Education: University vs. Middle-junior high (Edu3 vs Edu1) at Some rights (Samesex2)  and 'Keep tax and spend' candidate (Tax2)
estimates use m10_coeEDU.ster
est des
preserve
drawnorm MG_b1-MG_b232, n(10000) means(e(b)) cov(e(V)) clear seed(1)
postutil clear
postfile mypost prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi using sim.dta, replace
noisily display "start"
generate x_betahat0 = MG_b137 + MG_b232 + MG_b1
generate x_betahat1 = MG_b137 + MG_b232 + MG_b3 + MG_b218 ///
+ MG_b17*h_pinterest + MG_b23*h_leftright + MG_b29*h_gender + MG_b35*h_age + MG_b41*h_italian + MG_b47*h_student + MG_b53*h_lyceum + MG_b59*h_eduimp ///
+ MG_b64*h_pinterest + MG_b68*h_leftright + MG_b72*h_gender + MG_b76*h_age + MG_b80*h_italian + MG_b84*h_student + MG_b88*h_lyceum + MG_b92*h_taximp ///
+ MG_b66*h_pinterest + MG_b70*h_leftright + MG_b74*h_gender + MG_b78*h_age + MG_b82*h_italian + MG_b86*h_student + MG_b90*h_lyceum + MG_b94*h_sseximp ///
+ MG_b103 + MG_b112 + MG_b115*h_survey + MG_b120*h_survey + MG_b122*h_survey
gen prob0=normal(x_betahat0)
gen prob1=normal(x_betahat1)
gen diff=prob1-prob0
egen probhat0=mean(prob0)
egen probhat1=mean(prob1)
egen diffhat=mean(diff)
tempname prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi   
_pctile prob0, p(2.5,97.5) 
scalar `lo0' = r(r1)
scalar `hi0' = r(r2)  
_pctile prob1, p(2.5,97.5)
scalar `lo1'= r(r1)
scalar `hi1'= r(r2)  
_pctile diff, p(2.5,97.5)
scalar `diff_lo'= r(r1)
scalar `diff_hi'= r(r2)  
scalar `prob_hat0'=probhat0
scalar `prob_hat1'=probhat1
scalar `diff_hat'=diffhat
post mypost (`prob_hat0') (`lo0') (`hi0') (`prob_hat1') (`lo1') (`hi1') (`diff_hat') (`diff_lo') (`diff_hi')
drop x_betahat0 x_betahat1 prob0 prob1 diff probhat0 probhat1 diffhat 
display ""
postclose mypost
use sim2.dta, clear
append using sim.dta
save sim2.dta, replace
restore, not
* Education: University vs. Middle-junior high (Edu3 vs Edu1) at No rights (Samesex3)  and 'Keep tax and spend' candidate (Tax2)
estimates use m10_coeEDU.ster
est des
preserve
drawnorm MG_b1-MG_b232, n(10000) means(e(b)) cov(e(V)) clear seed(1)
postutil clear
postfile mypost prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi using sim.dta, replace
noisily display "start"
generate x_betahat0 = MG_b137 + MG_b232 + MG_b1
generate x_betahat1 = MG_b137 + MG_b232 + MG_b3 + MG_b218 ///
+ MG_b17*h_pinterest + MG_b23*h_leftright + MG_b29*h_gender + MG_b35*h_age + MG_b41*h_italian + MG_b47*h_student + MG_b53*h_lyceum + MG_b59*h_eduimp ///
+ MG_b64*h_pinterest + MG_b68*h_leftright + MG_b72*h_gender + MG_b76*h_age + MG_b80*h_italian + MG_b84*h_student + MG_b88*h_lyceum + MG_b92*h_taximp ///
+ MG_b67*h_pinterest + MG_b71*h_leftright + MG_b75*h_gender + MG_b79*h_age + MG_b83*h_italian + MG_b87*h_student + MG_b91*h_lyceum + MG_b95*h_sseximp ///
+ MG_b103 + MG_b113 + MG_b115*h_survey + MG_b120*h_survey + MG_b123*h_survey
gen prob0=normal(x_betahat0)
gen prob1=normal(x_betahat1)
gen diff=prob1-prob0
egen probhat0=mean(prob0)
egen probhat1=mean(prob1)
egen diffhat=mean(diff)
tempname prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi   
_pctile prob0, p(2.5,97.5) 
scalar `lo0' = r(r1)
scalar `hi0' = r(r2)  
_pctile prob1, p(2.5,97.5)
scalar `lo1'= r(r1)
scalar `hi1'= r(r2)  
_pctile diff, p(2.5,97.5)
scalar `diff_lo'= r(r1)
scalar `diff_hi'= r(r2)  
scalar `prob_hat0'=probhat0
scalar `prob_hat1'=probhat1
scalar `diff_hat'=diffhat
post mypost (`prob_hat0') (`lo0') (`hi0') (`prob_hat1') (`lo1') (`hi1') (`diff_hat') (`diff_lo') (`diff_hi')
drop x_betahat0 x_betahat1 prob0 prob1 diff probhat0 probhat1 diffhat 
display ""
postclose mypost
use sim2.dta, clear
append using sim.dta
save sim2.dta, replace
restore, not
**********   EDUCATION * SAMESEX Interaction
* Education: University vs. Middle-junior high (Edu3 vs Edu1) at Same rights (Samesex1) and 'Cut tax and spend' candidate (Tax3)
estimates use m10_coeEDU.ster
est des
preserve
drawnorm MG_b1-MG_b232, n(10000) means(e(b)) cov(e(V)) clear seed(1)
postutil clear
postfile mypost prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi using sim.dta, replace
noisily display "start"
generate x_betahat0 = MG_b137 + MG_b232 + MG_b1
generate x_betahat1 = MG_b137 + MG_b232 + MG_b3 + MG_b218 ///
+ MG_b17*h_pinterest + MG_b23*h_leftright + MG_b29*h_gender + MG_b35*h_age + MG_b41*h_italian + MG_b47*h_student + MG_b53*h_lyceum + MG_b59*h_eduimp ///
+ MG_b65*h_pinterest + MG_b69*h_leftright + MG_b73*h_gender + MG_b77*h_age + MG_b81*h_italian + MG_b85*h_student + MG_b89*h_lyceum + MG_b93*h_taximp ///
+ MG_b104 + MG_b115*h_survey + MG_b121*h_survey
gen prob0=normal(x_betahat0)
gen prob1=normal(x_betahat1)
gen diff=prob1-prob0
egen probhat0=mean(prob0)
egen probhat1=mean(prob1)
egen diffhat=mean(diff)
tempname prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi   
_pctile prob0, p(2.5,97.5) 
scalar `lo0' = r(r1)
scalar `hi0' = r(r2)  
_pctile prob1, p(2.5,97.5)
scalar `lo1'= r(r1)
scalar `hi1'= r(r2)  
_pctile diff, p(2.5,97.5)
scalar `diff_lo'= r(r1)
scalar `diff_hi'= r(r2)  
scalar `prob_hat0'=probhat0
scalar `prob_hat1'=probhat1
scalar `diff_hat'=diffhat
post mypost (`prob_hat0') (`lo0') (`hi0') (`prob_hat1') (`lo1') (`hi1') (`diff_hat') (`diff_lo') (`diff_hi')
drop x_betahat0 x_betahat1 prob0 prob1 diff probhat0 probhat1 diffhat 
display ""
postclose mypost
use sim2.dta, clear
append using sim.dta
save sim2.dta, replace
restore, not
* Education: University vs. Middle-junior high (Edu3 vs Edu1) at Some rights (Samesex2)  and 'Cut tax and spend' candidate (Tax3)
estimates use m10_coeEDU.ster
est des
preserve
drawnorm MG_b1-MG_b232, n(10000) means(e(b)) cov(e(V)) clear seed(1)
postutil clear
postfile mypost prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi using sim.dta, replace
noisily display "start"
generate x_betahat0 = MG_b137 + MG_b232 + MG_b1
generate x_betahat1 = MG_b137 + MG_b232 + MG_b3 + MG_b218 ///
+ MG_b17*h_pinterest + MG_b23*h_leftright + MG_b29*h_gender + MG_b35*h_age + MG_b41*h_italian + MG_b47*h_student + MG_b53*h_lyceum + MG_b59*h_eduimp ///
+ MG_b65*h_pinterest + MG_b69*h_leftright + MG_b73*h_gender + MG_b77*h_age + MG_b81*h_italian + MG_b85*h_student + MG_b89*h_lyceum + MG_b93*h_taximp ///
+ MG_b66*h_pinterest + MG_b70*h_leftright + MG_b74*h_gender + MG_b78*h_age + MG_b82*h_italian + MG_b86*h_student + MG_b90*h_lyceum + MG_b94*h_sseximp ///
+ MG_b104 + MG_b112 + MG_b115*h_survey + MG_b121*h_survey + MG_b122*h_survey
gen prob0=normal(x_betahat0)
gen prob1=normal(x_betahat1)
gen diff=prob1-prob0
egen probhat0=mean(prob0)
egen probhat1=mean(prob1)
egen diffhat=mean(diff)
tempname prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi   
_pctile prob0, p(2.5,97.5) 
scalar `lo0' = r(r1)
scalar `hi0' = r(r2)  
_pctile prob1, p(2.5,97.5)
scalar `lo1'= r(r1)
scalar `hi1'= r(r2)  
_pctile diff, p(2.5,97.5)
scalar `diff_lo'= r(r1)
scalar `diff_hi'= r(r2)  
scalar `prob_hat0'=probhat0
scalar `prob_hat1'=probhat1
scalar `diff_hat'=diffhat
post mypost (`prob_hat0') (`lo0') (`hi0') (`prob_hat1') (`lo1') (`hi1') (`diff_hat') (`diff_lo') (`diff_hi')
drop x_betahat0 x_betahat1 prob0 prob1 diff probhat0 probhat1 diffhat 
display ""
postclose mypost
use sim2.dta, clear
append using sim.dta
save sim2.dta, replace
restore, not
* Education: University vs. Middle-junior high (Edu3 vs Edu1) at No rights (Samesex3)  and 'Cut tax and spend' candidate (Tax3)
estimates use m10_coeEDU.ster
est des
preserve
drawnorm MG_b1-MG_b232, n(10000) means(e(b)) cov(e(V)) clear seed(1)
postutil clear
postfile mypost prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi using sim.dta, replace
noisily display "start"
generate x_betahat0 = MG_b137 + MG_b232 + MG_b1
generate x_betahat1 = MG_b137 + MG_b232 + MG_b3 + MG_b218 ///
+ MG_b17*h_pinterest + MG_b23*h_leftright + MG_b29*h_gender + MG_b35*h_age + MG_b41*h_italian + MG_b47*h_student + MG_b53*h_lyceum + MG_b59*h_eduimp ///
+ MG_b65*h_pinterest + MG_b69*h_leftright + MG_b73*h_gender + MG_b77*h_age + MG_b81*h_italian + MG_b85*h_student + MG_b89*h_lyceum + MG_b93*h_taximp ///
+ MG_b67*h_pinterest + MG_b71*h_leftright + MG_b75*h_gender + MG_b79*h_age + MG_b83*h_italian + MG_b87*h_student + MG_b91*h_lyceum + MG_b95*h_sseximp ///
+ MG_b104 + MG_b113 + MG_b115*h_survey + MG_b121*h_survey + MG_b123*h_survey
gen prob0=normal(x_betahat0)
gen prob1=normal(x_betahat1)
gen diff=prob1-prob0
egen probhat0=mean(prob0)
egen probhat1=mean(prob1)
egen diffhat=mean(diff)
tempname prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi   
_pctile prob0, p(2.5,97.5) 
scalar `lo0' = r(r1)
scalar `hi0' = r(r2)  
_pctile prob1, p(2.5,97.5)
scalar `lo1'= r(r1)
scalar `hi1'= r(r2)  
_pctile diff, p(2.5,97.5)
scalar `diff_lo'= r(r1)
scalar `diff_hi'= r(r2)  
scalar `prob_hat0'=probhat0
scalar `prob_hat1'=probhat1
scalar `diff_hat'=diffhat
post mypost (`prob_hat0') (`lo0') (`hi0') (`prob_hat1') (`lo1') (`hi1') (`diff_hat') (`diff_lo') (`diff_hi')
drop x_betahat0 x_betahat1 prob0 prob1 diff probhat0 probhat1 diffhat 
display ""
postclose mypost
use sim2.dta, clear
append using sim.dta
save sim2.dta, replace
restore, not
**********   INCOME (TASK NO.14)
* Income: Low (Inc1) 
estimates use m10_coeINC.ster
est des
preserve
drawnorm MG_b1-MG_b232, n(10000) means(e(b)) cov(e(V)) clear seed(1)
postutil clear
postfile mypost prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi using sim.dta, replace
noisily display "start"
generate x_betahat0 = MG_b137 + MG_b232 + MG_b4
generate x_betahat1 = MG_b137 + MG_b232 + MG_b4
gen prob0=normal(x_betahat0)
gen prob1=normal(x_betahat1)
gen diff=prob1-prob0
egen probhat0=mean(prob0)
egen probhat1=mean(prob1)
egen diffhat=mean(diff)
tempname prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi   
_pctile prob0, p(2.5,97.5) 
scalar `lo0' = r(r1)
scalar `hi0' = r(r2)  
_pctile prob1, p(2.5,97.5)
scalar `lo1'= r(r1)
scalar `hi1'= r(r2)  
_pctile diff, p(2.5,97.5)
scalar `diff_lo'= r(r1)
scalar `diff_hi'= r(r2)  
scalar `prob_hat0'=probhat0
scalar `prob_hat1'=probhat1
scalar `diff_hat'=diffhat
post mypost (`prob_hat0') (`lo0') (`hi0') (`prob_hat1') (`lo1') (`hi1') (`diff_hat') (`diff_lo') (`diff_hi')
drop x_betahat0 x_betahat1 prob0 prob1 diff probhat0 probhat1 diffhat 
display ""
postclose mypost
use sim2.dta, clear
append using sim.dta
save sim2.dta, replace
restore, not
* Income: Middle vs. Low (Inc2 vs Inc1) 
estimates use m10_coeINC.ster
est des
preserve
drawnorm MG_b1-MG_b232, n(10000) means(e(b)) cov(e(V)) clear seed(1)
postutil clear
postfile mypost prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi using sim.dta, replace
noisily display "start"
generate x_betahat0 = MG_b137 + MG_b232 + MG_b4
generate x_betahat1 = MG_b137 + MG_b232 + MG_b5 + MG_b18*h_pinterest + MG_b24*h_leftright + MG_b30*h_gender + MG_b36*h_age + MG_b42*h_italian + MG_b48*h_student ///
+ MG_b54*h_lyceum + MG_b60*h_incimp + MG_b116*h_survey + MG_b191
gen prob0=normal(x_betahat0)
gen prob1=normal(x_betahat1)
gen diff=prob1-prob0
egen probhat0=mean(prob0)
egen probhat1=mean(prob1)
egen diffhat=mean(diff)
tempname prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi   
_pctile prob0, p(2.5,97.5) 
scalar `lo0' = r(r1)
scalar `hi0' = r(r2)  
_pctile prob1, p(2.5,97.5)
scalar `lo1'= r(r1)
scalar `hi1'= r(r2)  
_pctile diff, p(2.5,97.5)
scalar `diff_lo'= r(r1)
scalar `diff_hi'= r(r2)  
scalar `prob_hat0'=probhat0
scalar `prob_hat1'=probhat1
scalar `diff_hat'=diffhat
post mypost (`prob_hat0') (`lo0') (`hi0') (`prob_hat1') (`lo1') (`hi1') (`diff_hat') (`diff_lo') (`diff_hi')
drop x_betahat0 x_betahat1 prob0 prob1 diff probhat0 probhat1 diffhat 
display ""
postclose mypost
use sim2.dta, clear
append using sim.dta
save sim2.dta, replace
restore, not
* Income: High vs. Low (Inc3 vs Inc1) 
estimates use m10_coeINC.ster
est des
preserve
drawnorm MG_b1-MG_b232, n(10000) means(e(b)) cov(e(V)) clear seed(1)
postutil clear
postfile mypost prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi using sim.dta, replace
noisily display "start"
generate x_betahat0 = MG_b137 + MG_b232 + MG_b4
generate x_betahat1 = MG_b137 + MG_b232 + MG_b6 + MG_b19*h_pinterest + MG_b25*h_leftright + MG_b31*h_gender + MG_b37*h_age + MG_b43*h_italian + MG_b49*h_student ///
+ MG_b55*h_lyceum + MG_b61*h_incimp + MG_b117*h_survey  + MG_b218
gen prob0=normal(x_betahat0)
gen prob1=normal(x_betahat1)
gen diff=prob1-prob0
egen probhat0=mean(prob0)
egen probhat1=mean(prob1)
egen diffhat=mean(diff)
tempname prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi   
_pctile prob0, p(2.5,97.5) 
scalar `lo0' = r(r1)
scalar `hi0' = r(r2)  
_pctile prob1, p(2.5,97.5)
scalar `lo1'= r(r1)
scalar `hi1'= r(r2)  
_pctile diff, p(2.5,97.5)
scalar `diff_lo'= r(r1)
scalar `diff_hi'= r(r2)  
scalar `prob_hat0'=probhat0
scalar `prob_hat1'=probhat1
scalar `diff_hat'=diffhat
post mypost (`prob_hat0') (`lo0') (`hi0') (`prob_hat1') (`lo1') (`hi1') (`diff_hat') (`diff_lo') (`diff_hi')
drop x_betahat0 x_betahat1 prob0 prob1 diff probhat0 probhat1 diffhat 
display ""
postclose mypost
use sim2.dta, clear
append using sim.dta
save sim2.dta, replace
restore, not
**********   CORRUPTION (TASK NO.14)
* Corruption: Clean (Corr1) 
estimates use m10_coeCOR.ster
est des
preserve
drawnorm MG_b1-MG_b232, n(10000) means(e(b)) cov(e(V)) clear seed(1)
postutil clear
postfile mypost prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi using sim.dta, replace
noisily display "start"
generate x_betahat0 = MG_b137 + MG_b232 + MG_b7
generate x_betahat1 = MG_b137 + MG_b232 + MG_b7
gen prob0=normal(x_betahat0)
gen prob1=normal(x_betahat1)
gen diff=prob1-prob0
egen probhat0=mean(prob0)
egen probhat1=mean(prob1)
egen diffhat=mean(diff)
tempname prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi   
_pctile prob0, p(2.5,97.5) 
scalar `lo0' = r(r1)
scalar `hi0' = r(r2)  
_pctile prob1, p(2.5,97.5)
scalar `lo1'= r(r1)
scalar `hi1'= r(r2)  
_pctile diff, p(2.5,97.5)
scalar `diff_lo'= r(r1)
scalar `diff_hi'= r(r2)  
scalar `prob_hat0'=probhat0
scalar `prob_hat1'=probhat1
scalar `diff_hat'=diffhat
post mypost (`prob_hat0') (`lo0') (`hi0') (`prob_hat1') (`lo1') (`hi1') (`diff_hat') (`diff_lo') (`diff_hi')
drop x_betahat0 x_betahat1 prob0 prob1 diff probhat0 probhat1 diffhat 
display ""
postclose mypost
use sim2.dta, clear
append using sim.dta
save sim2.dta, replace
restore, not
* Corruption: Investigated vs. Clean (Corr2 vs Corr1) 
estimates use m10_coeCOR.ster
est des
preserve
drawnorm MG_b1-MG_b232, n(10000) means(e(b)) cov(e(V)) clear seed(1)
postutil clear
postfile mypost prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi using sim.dta, replace
noisily display "start"
generate x_betahat0 = MG_b137 + MG_b232 + MG_b7
generate x_betahat1 = MG_b137 + MG_b232 + MG_b8 + MG_b20*h_pinterest + MG_b26*h_leftright + MG_b32*h_gender + MG_b38*h_age + MG_b44*h_italian + MG_b50*h_student ///
+ MG_b56*h_lyceum + MG_b62*h_honimp + MG_b118*h_survey + MG_b191
gen prob0=normal(x_betahat0)
gen prob1=normal(x_betahat1)
gen diff=prob1-prob0
egen probhat0=mean(prob0)
egen probhat1=mean(prob1)
egen diffhat=mean(diff)
tempname prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi   
_pctile prob0, p(2.5,97.5) 
scalar `lo0' = r(r1)
scalar `hi0' = r(r2)  
_pctile prob1, p(2.5,97.5)
scalar `lo1'= r(r1)
scalar `hi1'= r(r2)  
_pctile diff, p(2.5,97.5)
scalar `diff_lo'= r(r1)
scalar `diff_hi'= r(r2)  
scalar `prob_hat0'=probhat0
scalar `prob_hat1'=probhat1
scalar `diff_hat'=diffhat
post mypost (`prob_hat0') (`lo0') (`hi0') (`prob_hat1') (`lo1') (`hi1') (`diff_hat') (`diff_lo') (`diff_hi')
drop x_betahat0 x_betahat1 prob0 prob1 diff probhat0 probhat1 diffhat 
display ""
postclose mypost
use sim2.dta, clear
append using sim.dta
save sim2.dta, replace
restore, not
* Corruption: Corrupt vs. Clean (Corr3 vs Corr1) 
estimates use m10_coeCOR.ster
est des
preserve
drawnorm MG_b1-MG_b232, n(10000) means(e(b)) cov(e(V)) clear seed(1)
postutil clear
postfile mypost prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi using sim.dta, replace
noisily display "start"
generate x_betahat0 = MG_b137 + MG_b232 + MG_b7
generate x_betahat1 = MG_b137 + MG_b232 + MG_b9 + MG_b21*h_pinterest + MG_b27*h_leftright + MG_b33*h_gender + MG_b39*h_age + MG_b45*h_italian + MG_b51*h_student ///
+ MG_b57*h_lyceum + MG_b63*h_honimp + MG_b119*h_survey + MG_b218
gen prob0=normal(x_betahat0)
gen prob1=normal(x_betahat1)
gen diff=prob1-prob0
egen probhat0=mean(prob0)
egen probhat1=mean(prob1)
egen diffhat=mean(diff)
tempname prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi   
_pctile prob0, p(2.5,97.5) 
scalar `lo0' = r(r1)
scalar `hi0' = r(r2)  
_pctile prob1, p(2.5,97.5)
scalar `lo1'= r(r1)
scalar `hi1'= r(r2)  
_pctile diff, p(2.5,97.5)
scalar `diff_lo'= r(r1)
scalar `diff_hi'= r(r2)  
scalar `prob_hat0'=probhat0
scalar `prob_hat1'=probhat1
scalar `diff_hat'=diffhat
post mypost (`prob_hat0') (`lo0') (`hi0') (`prob_hat1') (`lo1') (`hi1') (`diff_hat') (`diff_lo') (`diff_hi')
drop x_betahat0 x_betahat1 prob0 prob1 diff probhat0 probhat1 diffhat 
display ""
postclose mypost
use sim2.dta, clear
append using sim.dta
save sim2.dta, replace
restore, not

gen MV = _n
eclplot diff_hat diff_hi diff_lo MV, estopts(msize(small)) rplottype(rspike) ciopts(msize(small)) graphregion(fcolor(white)) hor title ("Task No.14", size(2)) ///
ytitle("") ysca(noline) ylabel(0.5 " " 1 " " 2 " " 3 " " 4 " " 5 " " 6 " " 7 " " ///
8 " " 9 " "  10 " " 11 " " 12 " " 13 " " 14 " " 15 " " 16 " " ///
17 " " 18 " "  19 " " 20 " " 21 " " 22 " " 23 " " 24 " " 25 " ", noticks labsize(2)) ///
ylabel(, nolabels noticks labsize(2)) ///
xtitle("") xlabel(-0.8 "-.8" -0.6 "-.6" -0.4 "-.4" -0.2 "-.2" 0 "0" 0.2 ".2" 0.4 ".4", noticks labsize(2)) xline(0, lpattern(dot) lcolor(black) lwidth(medthin)) ///
text(1.5 0 "{it:More tax-spend}", place(c) just(center) size(2)) ///
text(4.5 0 "{it:Mantain tax-spend}", place(c) just(center) size(2)) ///
text(7.5 0 "{it:Less tax-spend}", place(c) just(center) size(2)) ///
text(10.5 0 "{it:More tax-spend}", place(c) just(center) size(2)) ///
text(13.5 0 "{it:Mantain tax-spend}", place(c) just(center) size(2)) ///
text(16.5 0 "{it:Less tax-spend}:", place(c) just(center) size(2)) ///
fxsize(40) saving(COE_14, replace)

**************************************************  TASK NO.27
**********   EDUCATION (TASK NO.27)
* Education: Junior High (Edu1) at Same rights (Samesex1) and 'More tax-spend' candidate (Tax1)
estimates use m10_coeEDU.ster
est des
preserve
drawnorm MG_b1-MG_b232, n(10000) means(e(b)) cov(e(V)) clear seed(1)
postutil clear
postfile mypost prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi using sim.dta, replace
noisily display "start"
generate x_betahat0 = MG_b150 + MG_b232 + MG_b1
generate x_betahat1 = MG_b150 + MG_b232 + MG_b1
gen prob0=normal(x_betahat0)
gen prob1=normal(x_betahat1)
gen diff=prob1-prob0
egen probhat0=mean(prob0)
egen probhat1=mean(prob1)
egen diffhat=mean(diff)
tempname prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi   
_pctile prob0, p(2.5,97.5) 
scalar `lo0' = r(r1)
scalar `hi0' = r(r2)  
_pctile prob1, p(2.5,97.5)
scalar `lo1'= r(r1)
scalar `hi1'= r(r2)  
_pctile diff, p(2.5,97.5)
scalar `diff_lo'= r(r1)
scalar `diff_hi'= r(r2)  
scalar `prob_hat0'=probhat0
scalar `prob_hat1'=probhat1
scalar `diff_hat'=diffhat
post mypost (`prob_hat0') (`lo0') (`hi0') (`prob_hat1') (`lo1') (`hi1') (`diff_hat') (`diff_lo') (`diff_hi')
drop x_betahat0 x_betahat1 prob0 prob1 diff probhat0 probhat1 diffhat 
display ""
postclose mypost
use sim.dta, clear
save sim2.dta, replace
restore, not
**********   EDUCATION * SAMESEX Interaction
* Education: High school vs. Middle-junior high (Edu2 vs Edu1) at Same rights (Samesex1) and 'More tax-spend' candidate (Tax1)
estimates use m10_coeEDU.ster
est des
preserve
drawnorm MG_b1-MG_b232, n(10000) means(e(b)) cov(e(V)) clear seed(1)
postutil clear
postfile mypost prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi using sim.dta, replace
noisily display "start"
generate x_betahat0 = MG_b150 + MG_b232 + MG_b1
generate x_betahat1 = MG_b150 + MG_b232 + MG_b2 + MG_b204 ///
+ MG_b16*h_pinterest + MG_b22*h_leftright + MG_b28*h_gender + MG_b34*h_age + MG_b40*h_italian + MG_b46*h_student + MG_b52*h_lyceum + MG_b58*h_eduimp + MG_b114*h_survey
gen prob0=normal(x_betahat0)
gen prob1=normal(x_betahat1)
gen diff=prob1-prob0
egen probhat0=mean(prob0)
egen probhat1=mean(prob1)
egen diffhat=mean(diff)
tempname prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi   
_pctile prob0, p(2.5,97.5) 
scalar `lo0' = r(r1)
scalar `hi0' = r(r2)  
_pctile prob1, p(2.5,97.5)
scalar `lo1'= r(r1)
scalar `hi1'= r(r2)  
_pctile diff, p(2.5,97.5)
scalar `diff_lo'= r(r1)
scalar `diff_hi'= r(r2)  
scalar `prob_hat0'=probhat0
scalar `prob_hat1'=probhat1
scalar `diff_hat'=diffhat
post mypost (`prob_hat0') (`lo0') (`hi0') (`prob_hat1') (`lo1') (`hi1') (`diff_hat') (`diff_lo') (`diff_hi')
drop x_betahat0 x_betahat1 prob0 prob1 diff probhat0 probhat1 diffhat 
display ""
postclose mypost
use sim2.dta, clear
append using sim.dta
save sim2.dta, replace
restore, not
* Education: High school vs. Middle-junior high (Edu2 vs Edu1) at Some rights (Samesex2) and 'More tax-spend' candidate (Tax1)
estimates use m10_coeEDU.ster
est des
preserve
drawnorm MG_b1-MG_b232, n(10000) means(e(b)) cov(e(V)) clear seed(1)
postutil clear
postfile mypost prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi using sim.dta, replace
noisily display "start"
generate x_betahat0 = MG_b150 + MG_b232 + MG_b1
generate x_betahat1 = MG_b150 + MG_b232 + MG_b2 + MG_b204 ///
+ MG_b16*h_pinterest + MG_b22*h_leftright + MG_b28*h_gender + MG_b34*h_age + MG_b40*h_italian + MG_b46*h_student + MG_b52*h_lyceum + MG_b58*h_eduimp ///
+ MG_b66*h_pinterest + MG_b70*h_leftright + MG_b74*h_gender + MG_b78*h_age + MG_b82*h_italian + MG_b86*h_student + MG_b90*h_lyceum + MG_b94*h_sseximp ///
+ MG_b109 + MG_b114*h_survey + MG_b122*h_survey
gen prob0=normal(x_betahat0)
gen prob1=normal(x_betahat1)
gen diff=prob1-prob0
egen probhat0=mean(prob0)
egen probhat1=mean(prob1)
egen diffhat=mean(diff)
tempname prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi   
_pctile prob0, p(2.5,97.5) 
scalar `lo0' = r(r1)
scalar `hi0' = r(r2)  
_pctile prob1, p(2.5,97.5)
scalar `lo1'= r(r1)
scalar `hi1'= r(r2)  
_pctile diff, p(2.5,97.5)
scalar `diff_lo'= r(r1)
scalar `diff_hi'= r(r2)  
scalar `prob_hat0'=probhat0
scalar `prob_hat1'=probhat1
scalar `diff_hat'=diffhat
post mypost (`prob_hat0') (`lo0') (`hi0') (`prob_hat1') (`lo1') (`hi1') (`diff_hat') (`diff_lo') (`diff_hi')
drop x_betahat0 x_betahat1 prob0 prob1 diff probhat0 probhat1 diffhat 
display ""
postclose mypost
use sim2.dta, clear
append using sim.dta
save sim2.dta, replace
restore, not
* Education: High school vs. Middle-junior high (Edu2 vs Edu1) at No rights (Samesex3) and 'More tax-spend' candidate (Tax1)
estimates use m10_coeEDU.ster
est des
preserve
drawnorm MG_b1-MG_b232, n(10000) means(e(b)) cov(e(V)) clear seed(1)
postutil clear
postfile mypost prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi using sim.dta, replace
noisily display "start"
generate x_betahat0 = MG_b150 + MG_b232 + MG_b1
generate x_betahat1 = MG_b150 + MG_b232 + MG_b2 + MG_b204 ///
+ MG_b16*h_pinterest + MG_b22*h_leftright + MG_b28*h_gender + MG_b34*h_age + MG_b40*h_italian + MG_b46*h_student + MG_b52*h_lyceum + MG_b58*h_eduimp ///
+ MG_b67*h_pinterest + MG_b71*h_leftright + MG_b75*h_gender + MG_b79*h_age + MG_b83*h_italian + MG_b87*h_student + MG_b91*h_lyceum + MG_b95*h_sseximp ///
+ MG_b110 + MG_b114*h_survey + MG_b123*h_survey
gen prob0=normal(x_betahat0)
gen prob1=normal(x_betahat1)
gen diff=prob1-prob0
egen probhat0=mean(prob0)
egen probhat1=mean(prob1)
egen diffhat=mean(diff)
tempname prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi   
_pctile prob0, p(2.5,97.5) 
scalar `lo0' = r(r1)
scalar `hi0' = r(r2)  
_pctile prob1, p(2.5,97.5)
scalar `lo1'= r(r1)
scalar `hi1'= r(r2)  
_pctile diff, p(2.5,97.5)
scalar `diff_lo'= r(r1)
scalar `diff_hi'= r(r2)  
scalar `prob_hat0'=probhat0
scalar `prob_hat1'=probhat1
scalar `diff_hat'=diffhat
post mypost (`prob_hat0') (`lo0') (`hi0') (`prob_hat1') (`lo1') (`hi1') (`diff_hat') (`diff_lo') (`diff_hi')
drop x_betahat0 x_betahat1 prob0 prob1 diff probhat0 probhat1 diffhat 
display ""
postclose mypost
use sim2.dta, clear
append using sim.dta
save sim2.dta, replace
restore, not
**********   EDUCATION * SAMESEX Interaction
* Education: High school vs. Middle-junior high (Edu2 vs Edu1) at Same rights (Samesex1) and 'Keep tax and spend' candidate (Tax2)
estimates use m10_coeEDU.ster
est des
preserve
drawnorm MG_b1-MG_b232, n(10000) means(e(b)) cov(e(V)) clear seed(1)
postutil clear
postfile mypost prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi using sim.dta, replace
noisily display "start"
generate x_betahat0 = MG_b150 + MG_b232 + MG_b1
generate x_betahat1 = MG_b150 + MG_b232 + MG_b2 + MG_b204 ///
+ MG_b16*h_pinterest + MG_b22*h_leftright + MG_b28*h_gender + MG_b34*h_age + MG_b40*h_italian + MG_b46*h_student + MG_b52*h_lyceum + MG_b58*h_eduimp ///
+ MG_b64*h_pinterest + MG_b68*h_leftright + MG_b72*h_gender + MG_b76*h_age + MG_b80*h_italian + MG_b84*h_student + MG_b88*h_lyceum + MG_b92*h_taximp ///
+ MG_b100 + MG_b114*h_survey + MG_b120*h_survey
gen prob0=normal(x_betahat0)
gen prob1=normal(x_betahat1)
gen diff=prob1-prob0
egen probhat0=mean(prob0)
egen probhat1=mean(prob1)
egen diffhat=mean(diff)
tempname prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi   
_pctile prob0, p(2.5,97.5) 
scalar `lo0' = r(r1)
scalar `hi0' = r(r2)  
_pctile prob1, p(2.5,97.5)
scalar `lo1'= r(r1)
scalar `hi1'= r(r2)  
_pctile diff, p(2.5,97.5)
scalar `diff_lo'= r(r1)
scalar `diff_hi'= r(r2)  
scalar `prob_hat0'=probhat0
scalar `prob_hat1'=probhat1
scalar `diff_hat'=diffhat
post mypost (`prob_hat0') (`lo0') (`hi0') (`prob_hat1') (`lo1') (`hi1') (`diff_hat') (`diff_lo') (`diff_hi')
drop x_betahat0 x_betahat1 prob0 prob1 diff probhat0 probhat1 diffhat 
display ""
postclose mypost
use sim2.dta, clear
append using sim.dta
save sim2.dta, replace
restore, not
* Education: High school vs. Middle-junior high (Edu2 vs Edu1) at Some rights (Samesex2) and 'Keep tax and spend' candidate (Tax2)
estimates use m10_coeEDU.ster
est des
preserve
drawnorm MG_b1-MG_b232, n(10000) means(e(b)) cov(e(V)) clear seed(1)
postutil clear
postfile mypost prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi using sim.dta, replace
noisily display "start"
generate x_betahat0 = MG_b150 + MG_b232 + MG_b1
generate x_betahat1 = MG_b150 + MG_b232 + MG_b2 + MG_b204 ///
+ MG_b16*h_pinterest + MG_b22*h_leftright + MG_b28*h_gender + MG_b34*h_age + MG_b40*h_italian + MG_b46*h_student + MG_b52*h_lyceum + MG_b58*h_eduimp ///
+ MG_b64*h_pinterest + MG_b68*h_leftright + MG_b72*h_gender + MG_b76*h_age + MG_b80*h_italian + MG_b84*h_student + MG_b88*h_lyceum + MG_b92*h_taximp ///
+ MG_b66*h_pinterest + MG_b70*h_leftright + MG_b74*h_gender + MG_b78*h_age + MG_b82*h_italian + MG_b86*h_student + MG_b90*h_lyceum + MG_b94*h_sseximp ///
+ MG_b100 + MG_b109 + MG_b114*h_survey + MG_b120*h_survey + MG_b122*h_survey
gen prob0=normal(x_betahat0)
gen prob1=normal(x_betahat1)
gen diff=prob1-prob0
egen probhat0=mean(prob0)
egen probhat1=mean(prob1)
egen diffhat=mean(diff)
tempname prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi   
_pctile prob0, p(2.5,97.5) 
scalar `lo0' = r(r1)
scalar `hi0' = r(r2)  
_pctile prob1, p(2.5,97.5)
scalar `lo1'= r(r1)
scalar `hi1'= r(r2)  
_pctile diff, p(2.5,97.5)
scalar `diff_lo'= r(r1)
scalar `diff_hi'= r(r2)  
scalar `prob_hat0'=probhat0
scalar `prob_hat1'=probhat1
scalar `diff_hat'=diffhat
post mypost (`prob_hat0') (`lo0') (`hi0') (`prob_hat1') (`lo1') (`hi1') (`diff_hat') (`diff_lo') (`diff_hi')
drop x_betahat0 x_betahat1 prob0 prob1 diff probhat0 probhat1 diffhat 
display ""
postclose mypost
use sim2.dta, clear
append using sim.dta
save sim2.dta, replace
restore, not
* Education: High school vs. Middle-junior high (Edu2 vs Edu1) at No rights (Samesex3) and 'Keep tax and spend' candidate (Tax2)
estimates use m10_coeEDU.ster
est des
preserve
drawnorm MG_b1-MG_b232, n(10000) means(e(b)) cov(e(V)) clear seed(1)
postutil clear
postfile mypost prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi using sim.dta, replace
noisily display "start"
generate x_betahat0 = MG_b150 + MG_b232 + MG_b1
generate x_betahat1 = MG_b150 + MG_b232 + MG_b2 + MG_b204 ///
+ MG_b16*h_pinterest + MG_b22*h_leftright + MG_b28*h_gender + MG_b34*h_age + MG_b40*h_italian + MG_b46*h_student + MG_b52*h_lyceum + MG_b58*h_eduimp ///
+ MG_b64*h_pinterest + MG_b68*h_leftright + MG_b72*h_gender + MG_b76*h_age + MG_b80*h_italian + MG_b84*h_student + MG_b88*h_lyceum + MG_b92*h_taximp ///
+ MG_b67*h_pinterest + MG_b71*h_leftright + MG_b75*h_gender + MG_b79*h_age + MG_b83*h_italian + MG_b87*h_student + MG_b91*h_lyceum + MG_b95*h_sseximp ///
+ MG_b100 + MG_b110 + MG_b114*h_survey + MG_b120*h_survey + MG_b123*h_survey
gen prob0=normal(x_betahat0)
gen prob1=normal(x_betahat1)
gen diff=prob1-prob0
egen probhat0=mean(prob0)
egen probhat1=mean(prob1)
egen diffhat=mean(diff)
tempname prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi   
_pctile prob0, p(2.5,97.5) 
scalar `lo0' = r(r1)
scalar `hi0' = r(r2)  
_pctile prob1, p(2.5,97.5)
scalar `lo1'= r(r1)
scalar `hi1'= r(r2)  
_pctile diff, p(2.5,97.5)
scalar `diff_lo'= r(r1)
scalar `diff_hi'= r(r2)  
scalar `prob_hat0'=probhat0
scalar `prob_hat1'=probhat1
scalar `diff_hat'=diffhat
post mypost (`prob_hat0') (`lo0') (`hi0') (`prob_hat1') (`lo1') (`hi1') (`diff_hat') (`diff_lo') (`diff_hi')
drop x_betahat0 x_betahat1 prob0 prob1 diff probhat0 probhat1 diffhat 
display ""
postclose mypost
use sim2.dta, clear
append using sim.dta
save sim2.dta, replace
restore, not
**********   EDUCATION * SAMESEX Interaction
* Education: High school vs. Middle-junior high (Edu2 vs Edu1) at Same rights (Samesex1) and 'Cut tax and spend' candidate (Tax3)
estimates use m10_coeEDU.ster
est des
preserve
drawnorm MG_b1-MG_b232, n(10000) means(e(b)) cov(e(V)) clear seed(1)
postutil clear
postfile mypost prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi using sim.dta, replace
noisily display "start"
generate x_betahat0 = MG_b150 + MG_b232 + MG_b1
generate x_betahat1 = MG_b150 + MG_b232 + MG_b2 + MG_b204 ///
+ MG_b16*h_pinterest + MG_b22*h_leftright + MG_b28*h_gender + MG_b34*h_age + MG_b40*h_italian + MG_b46*h_student + MG_b52*h_lyceum + MG_b58*h_eduimp ///
+ MG_b65*h_pinterest + MG_b69*h_leftright + MG_b73*h_gender + MG_b77*h_age + MG_b81*h_italian + MG_b85*h_student + MG_b89*h_lyceum + MG_b93*h_taximp ///
+ MG_b101 + MG_b114*h_survey + MG_b121*h_survey
gen prob0=normal(x_betahat0)
gen prob1=normal(x_betahat1)
gen diff=prob1-prob0
egen probhat0=mean(prob0)
egen probhat1=mean(prob1)
egen diffhat=mean(diff)
tempname prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi   
_pctile prob0, p(2.5,97.5) 
scalar `lo0' = r(r1)
scalar `hi0' = r(r2)  
_pctile prob1, p(2.5,97.5)
scalar `lo1'= r(r1)
scalar `hi1'= r(r2)  
_pctile diff, p(2.5,97.5)
scalar `diff_lo'= r(r1)
scalar `diff_hi'= r(r2)  
scalar `prob_hat0'=probhat0
scalar `prob_hat1'=probhat1
scalar `diff_hat'=diffhat
post mypost (`prob_hat0') (`lo0') (`hi0') (`prob_hat1') (`lo1') (`hi1') (`diff_hat') (`diff_lo') (`diff_hi')
drop x_betahat0 x_betahat1 prob0 prob1 diff probhat0 probhat1 diffhat 
display ""
postclose mypost
use sim2.dta, clear
append using sim.dta
save sim2.dta, replace
restore, not
* Education: High school vs. Middle-junior high (Edu2 vs Edu1) at Some rights (Samesex2) and 'Cut tax and spend' candidate (Tax3)
estimates use m10_coeEDU.ster
est des
preserve
drawnorm MG_b1-MG_b232, n(10000) means(e(b)) cov(e(V)) clear seed(1)
postutil clear
postfile mypost prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi using sim.dta, replace
noisily display "start"
generate x_betahat0 = MG_b150 + MG_b232 + MG_b1
generate x_betahat1 = MG_b150 + MG_b232 + MG_b2 + MG_b204 ///
+ MG_b16*h_pinterest + MG_b22*h_leftright + MG_b28*h_gender + MG_b34*h_age + MG_b40*h_italian + MG_b46*h_student + MG_b52*h_lyceum + MG_b58*h_eduimp ///
+ MG_b65*h_pinterest + MG_b69*h_leftright + MG_b73*h_gender + MG_b77*h_age + MG_b81*h_italian + MG_b85*h_student + MG_b89*h_lyceum + MG_b93*h_taximp ///
+ MG_b66*h_pinterest + MG_b70*h_leftright + MG_b74*h_gender + MG_b78*h_age + MG_b82*h_italian + MG_b86*h_student + MG_b90*h_lyceum + MG_b94*h_sseximp ///
+ MG_b101 + MG_b109 + MG_b114*h_survey + MG_b121*h_survey + MG_b122*h_survey
gen prob0=normal(x_betahat0)
gen prob1=normal(x_betahat1)
gen diff=prob1-prob0
egen probhat0=mean(prob0)
egen probhat1=mean(prob1)
egen diffhat=mean(diff)
tempname prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi   
_pctile prob0, p(2.5,97.5) 
scalar `lo0' = r(r1)
scalar `hi0' = r(r2)  
_pctile prob1, p(2.5,97.5)
scalar `lo1'= r(r1)
scalar `hi1'= r(r2)  
_pctile diff, p(2.5,97.5)
scalar `diff_lo'= r(r1)
scalar `diff_hi'= r(r2)  
scalar `prob_hat0'=probhat0
scalar `prob_hat1'=probhat1
scalar `diff_hat'=diffhat
post mypost (`prob_hat0') (`lo0') (`hi0') (`prob_hat1') (`lo1') (`hi1') (`diff_hat') (`diff_lo') (`diff_hi')
drop x_betahat0 x_betahat1 prob0 prob1 diff probhat0 probhat1 diffhat 
display ""
postclose mypost
use sim2.dta, clear
append using sim.dta
save sim2.dta, replace
restore, not
* Education: High school vs. Middle-junior high (Edu2 vs Edu1) at No rights (Samesex3)  and 'Cut tax and spend' candidate (Tax3)
estimates use m10_coeEDU.ster
est des
preserve
drawnorm MG_b1-MG_b232, n(10000) means(e(b)) cov(e(V)) clear seed(1)
postutil clear
postfile mypost prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi using sim.dta, replace
noisily display "start"
generate x_betahat0 = MG_b150 + MG_b232 + MG_b1
generate x_betahat1 = MG_b150 + MG_b232 + MG_b2 + MG_b204 ///
+ MG_b16*h_pinterest + MG_b22*h_leftright + MG_b28*h_gender + MG_b34*h_age + MG_b40*h_italian + MG_b46*h_student + MG_b52*h_lyceum + MG_b58*h_eduimp ///
+ MG_b65*h_pinterest + MG_b69*h_leftright + MG_b73*h_gender + MG_b77*h_age + MG_b81*h_italian + MG_b85*h_student + MG_b89*h_lyceum + MG_b93*h_taximp ///
+ MG_b67*h_pinterest + MG_b71*h_leftright + MG_b75*h_gender + MG_b79*h_age + MG_b83*h_italian + MG_b87*h_student + MG_b91*h_lyceum + MG_b95*h_sseximp ///
+ MG_b101 + MG_b110 + MG_b114*h_survey + MG_b121*h_survey + MG_b123*h_survey
gen prob0=normal(x_betahat0)
gen prob1=normal(x_betahat1)
gen diff=prob1-prob0
egen probhat0=mean(prob0)
egen probhat1=mean(prob1)
egen diffhat=mean(diff)
tempname prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi   
_pctile prob0, p(2.5,97.5) 
scalar `lo0' = r(r1)
scalar `hi0' = r(r2)  
_pctile prob1, p(2.5,97.5)
scalar `lo1'= r(r1)
scalar `hi1'= r(r2)  
_pctile diff, p(2.5,97.5)
scalar `diff_lo'= r(r1)
scalar `diff_hi'= r(r2)  
scalar `prob_hat0'=probhat0
scalar `prob_hat1'=probhat1
scalar `diff_hat'=diffhat
post mypost (`prob_hat0') (`lo0') (`hi0') (`prob_hat1') (`lo1') (`hi1') (`diff_hat') (`diff_lo') (`diff_hi')
drop x_betahat0 x_betahat1 prob0 prob1 diff probhat0 probhat1 diffhat 
display ""
postclose mypost
use sim2.dta, clear
append using sim.dta
save sim2.dta, replace
restore, not
**********   EDUCATION * SAMESEX Interaction
* Education: University vs. Middle-junior high (Edu3 vs Edu1) at Same rights (Samesex1) and 'More tax-spend' candidate (Tax1)
estimates use m10_coeEDU.ster
est des
preserve
drawnorm MG_b1-MG_b232, n(10000) means(e(b)) cov(e(V)) clear seed(1)
postutil clear
postfile mypost prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi using sim.dta, replace
noisily display "start"
generate x_betahat0 = MG_b150 + MG_b232 + MG_b1
generate x_betahat1 = MG_b150 + MG_b232 + MG_b3 + MG_b231 ///
+ MG_b17*h_pinterest + MG_b23*h_leftright + MG_b29*h_gender + MG_b35*h_age + MG_b41*h_italian + MG_b47*h_student + MG_b53*h_lyceum + MG_b59*h_eduimp + MG_b115*h_survey
gen prob0=normal(x_betahat0)
gen prob1=normal(x_betahat1)
gen diff=prob1-prob0
egen probhat0=mean(prob0)
egen probhat1=mean(prob1)
egen diffhat=mean(diff)
tempname prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi   
_pctile prob0, p(2.5,97.5) 
scalar `lo0' = r(r1)
scalar `hi0' = r(r2)  
_pctile prob1, p(2.5,97.5)
scalar `lo1'= r(r1)
scalar `hi1'= r(r2)  
_pctile diff, p(2.5,97.5)
scalar `diff_lo'= r(r1)
scalar `diff_hi'= r(r2)  
scalar `prob_hat0'=probhat0
scalar `prob_hat1'=probhat1
scalar `diff_hat'=diffhat
post mypost (`prob_hat0') (`lo0') (`hi0') (`prob_hat1') (`lo1') (`hi1') (`diff_hat') (`diff_lo') (`diff_hi')
drop x_betahat0 x_betahat1 prob0 prob1 diff probhat0 probhat1 diffhat 
display ""
postclose mypost
use sim2.dta, clear
append using sim.dta
save sim2.dta, replace
restore, not
* Education: University vs. Middle-junior high (Edu3 vs Edu1) at Some rights (Samesex2) and 'More tax-spend' candidate (Tax1)
estimates use m10_coeEDU.ster
est des
preserve
drawnorm MG_b1-MG_b232, n(10000) means(e(b)) cov(e(V)) clear seed(1)
postutil clear
postfile mypost prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi using sim.dta, replace
noisily display "start"
generate x_betahat0 = MG_b150 + MG_b232 + MG_b1
generate x_betahat1 = MG_b150 + MG_b232 + MG_b3 + MG_b231 ///
+ MG_b17*h_pinterest + MG_b23*h_leftright + MG_b29*h_gender + MG_b35*h_age + MG_b41*h_italian + MG_b47*h_student + MG_b53*h_lyceum + MG_b59*h_eduimp ///
+ MG_b66*h_pinterest + MG_b70*h_leftright + MG_b74*h_gender + MG_b78*h_age + MG_b82*h_italian + MG_b86*h_student + MG_b90*h_lyceum + MG_b94*h_sseximp ///
+ MG_b112 + MG_b115*h_survey + MG_b122*h_survey
gen prob0=normal(x_betahat0)
gen prob1=normal(x_betahat1)
gen diff=prob1-prob0
egen probhat0=mean(prob0)
egen probhat1=mean(prob1)
egen diffhat=mean(diff)
tempname prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi   
_pctile prob0, p(2.5,97.5) 
scalar `lo0' = r(r1)
scalar `hi0' = r(r2)  
_pctile prob1, p(2.5,97.5)
scalar `lo1'= r(r1)
scalar `hi1'= r(r2)  
_pctile diff, p(2.5,97.5)
scalar `diff_lo'= r(r1)
scalar `diff_hi'= r(r2)  
scalar `prob_hat0'=probhat0
scalar `prob_hat1'=probhat1
scalar `diff_hat'=diffhat
post mypost (`prob_hat0') (`lo0') (`hi0') (`prob_hat1') (`lo1') (`hi1') (`diff_hat') (`diff_lo') (`diff_hi')
drop x_betahat0 x_betahat1 prob0 prob1 diff probhat0 probhat1 diffhat 
display ""
postclose mypost
use sim2.dta, clear
append using sim.dta
save sim2.dta, replace
restore, not
* Education: University vs. Middle-junior high (Edu3 vs Edu1) at No rights (Samesex3)  and 'More tax-spend' candidate (Tax1)
estimates use m10_coeEDU.ster
est des
preserve
drawnorm MG_b1-MG_b232, n(10000) means(e(b)) cov(e(V)) clear seed(1)
postutil clear
postfile mypost prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi using sim.dta, replace
noisily display "start"
generate x_betahat0 = MG_b150 + MG_b232 + MG_b1
generate x_betahat1 = MG_b150 + MG_b232 + MG_b3 + MG_b231 ///
+ MG_b17*h_pinterest + MG_b23*h_leftright + MG_b29*h_gender + MG_b35*h_age + MG_b41*h_italian + MG_b47*h_student + MG_b53*h_lyceum + MG_b59*h_eduimp ///
+ MG_b67*h_pinterest + MG_b71*h_leftright + MG_b75*h_gender + MG_b79*h_age + MG_b83*h_italian + MG_b87*h_student + MG_b91*h_lyceum + MG_b95*h_sseximp ///
+ MG_b113 + MG_b115*h_survey + MG_b123*h_survey
gen prob0=normal(x_betahat0)
gen prob1=normal(x_betahat1)
gen diff=prob1-prob0
egen probhat0=mean(prob0)
egen probhat1=mean(prob1)
egen diffhat=mean(diff)
tempname prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi   
_pctile prob0, p(2.5,97.5) 
scalar `lo0' = r(r1)
scalar `hi0' = r(r2)  
_pctile prob1, p(2.5,97.5)
scalar `lo1'= r(r1)
scalar `hi1'= r(r2)  
_pctile diff, p(2.5,97.5)
scalar `diff_lo'= r(r1)
scalar `diff_hi'= r(r2)  
scalar `prob_hat0'=probhat0
scalar `prob_hat1'=probhat1
scalar `diff_hat'=diffhat
post mypost (`prob_hat0') (`lo0') (`hi0') (`prob_hat1') (`lo1') (`hi1') (`diff_hat') (`diff_lo') (`diff_hi')
drop x_betahat0 x_betahat1 prob0 prob1 diff probhat0 probhat1 diffhat 
display ""
postclose mypost
use sim2.dta, clear
append using sim.dta
save sim2.dta, replace
restore, not
**********   EDUCATION * SAMESEX Interaction
* Education: University vs. Middle-junior high (Edu3 vs Edu1) at Same rights (Samesex1) and 'Keep tax and spend' candidate (Tax2)
estimates use m10_coeEDU.ster
est des
preserve
drawnorm MG_b1-MG_b232, n(10000) means(e(b)) cov(e(V)) clear seed(1)
postutil clear
postfile mypost prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi using sim.dta, replace
noisily display "start"
generate x_betahat0 = MG_b150 + MG_b232 + MG_b1
generate x_betahat1 = MG_b150 + MG_b232 + MG_b3 + MG_b231 ///
+ MG_b17*h_pinterest + MG_b23*h_leftright + MG_b29*h_gender + MG_b35*h_age + MG_b41*h_italian + MG_b47*h_student + MG_b53*h_lyceum + MG_b59*h_eduimp ///
+ MG_b64*h_pinterest + MG_b68*h_leftright + MG_b72*h_gender + MG_b76*h_age + MG_b80*h_italian + MG_b84*h_student + MG_b88*h_lyceum + MG_b92*h_taximp ///
+ MG_b103 + MG_b115*h_survey + MG_b120*h_survey
gen prob0=normal(x_betahat0)
gen prob1=normal(x_betahat1)
gen diff=prob1-prob0
egen probhat0=mean(prob0)
egen probhat1=mean(prob1)
egen diffhat=mean(diff)
tempname prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi   
_pctile prob0, p(2.5,97.5) 
scalar `lo0' = r(r1)
scalar `hi0' = r(r2)  
_pctile prob1, p(2.5,97.5)
scalar `lo1'= r(r1)
scalar `hi1'= r(r2)  
_pctile diff, p(2.5,97.5)
scalar `diff_lo'= r(r1)
scalar `diff_hi'= r(r2)  
scalar `prob_hat0'=probhat0
scalar `prob_hat1'=probhat1
scalar `diff_hat'=diffhat
post mypost (`prob_hat0') (`lo0') (`hi0') (`prob_hat1') (`lo1') (`hi1') (`diff_hat') (`diff_lo') (`diff_hi')
drop x_betahat0 x_betahat1 prob0 prob1 diff probhat0 probhat1 diffhat 
display ""
postclose mypost
use sim2.dta, clear
append using sim.dta
save sim2.dta, replace
restore, not
* Education: University vs. Middle-junior high (Edu3 vs Edu1) at Some rights (Samesex2)  and 'Keep tax and spend' candidate (Tax2)
estimates use m10_coeEDU.ster
est des
preserve
drawnorm MG_b1-MG_b232, n(10000) means(e(b)) cov(e(V)) clear seed(1)
postutil clear
postfile mypost prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi using sim.dta, replace
noisily display "start"
generate x_betahat0 = MG_b150 + MG_b232 + MG_b1
generate x_betahat1 = MG_b150 + MG_b232 + MG_b3 + MG_b231 ///
+ MG_b17*h_pinterest + MG_b23*h_leftright + MG_b29*h_gender + MG_b35*h_age + MG_b41*h_italian + MG_b47*h_student + MG_b53*h_lyceum + MG_b59*h_eduimp ///
+ MG_b64*h_pinterest + MG_b68*h_leftright + MG_b72*h_gender + MG_b76*h_age + MG_b80*h_italian + MG_b84*h_student + MG_b88*h_lyceum + MG_b92*h_taximp ///
+ MG_b66*h_pinterest + MG_b70*h_leftright + MG_b74*h_gender + MG_b78*h_age + MG_b82*h_italian + MG_b86*h_student + MG_b90*h_lyceum + MG_b94*h_sseximp ///
+ MG_b103 + MG_b112 + MG_b115*h_survey + MG_b120*h_survey + MG_b122*h_survey
gen prob0=normal(x_betahat0)
gen prob1=normal(x_betahat1)
gen diff=prob1-prob0
egen probhat0=mean(prob0)
egen probhat1=mean(prob1)
egen diffhat=mean(diff)
tempname prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi   
_pctile prob0, p(2.5,97.5) 
scalar `lo0' = r(r1)
scalar `hi0' = r(r2)  
_pctile prob1, p(2.5,97.5)
scalar `lo1'= r(r1)
scalar `hi1'= r(r2)  
_pctile diff, p(2.5,97.5)
scalar `diff_lo'= r(r1)
scalar `diff_hi'= r(r2)  
scalar `prob_hat0'=probhat0
scalar `prob_hat1'=probhat1
scalar `diff_hat'=diffhat
post mypost (`prob_hat0') (`lo0') (`hi0') (`prob_hat1') (`lo1') (`hi1') (`diff_hat') (`diff_lo') (`diff_hi')
drop x_betahat0 x_betahat1 prob0 prob1 diff probhat0 probhat1 diffhat 
display ""
postclose mypost
use sim2.dta, clear
append using sim.dta
save sim2.dta, replace
restore, not
* Education: University vs. Middle-junior high (Edu3 vs Edu1) at No rights (Samesex3)  and 'Keep tax and spend' candidate (Tax2)
estimates use m10_coeEDU.ster
est des
preserve
drawnorm MG_b1-MG_b232, n(10000) means(e(b)) cov(e(V)) clear seed(1)
postutil clear
postfile mypost prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi using sim.dta, replace
noisily display "start"
generate x_betahat0 = MG_b150 + MG_b232 + MG_b1
generate x_betahat1 = MG_b150 + MG_b232 + MG_b3 + MG_b231 ///
+ MG_b17*h_pinterest + MG_b23*h_leftright + MG_b29*h_gender + MG_b35*h_age + MG_b41*h_italian + MG_b47*h_student + MG_b53*h_lyceum + MG_b59*h_eduimp ///
+ MG_b64*h_pinterest + MG_b68*h_leftright + MG_b72*h_gender + MG_b76*h_age + MG_b80*h_italian + MG_b84*h_student + MG_b88*h_lyceum + MG_b92*h_taximp ///
+ MG_b67*h_pinterest + MG_b71*h_leftright + MG_b75*h_gender + MG_b79*h_age + MG_b83*h_italian + MG_b87*h_student + MG_b91*h_lyceum + MG_b95*h_sseximp ///
+ MG_b103 + MG_b113 + MG_b115*h_survey + MG_b120*h_survey + MG_b123*h_survey
gen prob0=normal(x_betahat0)
gen prob1=normal(x_betahat1)
gen diff=prob1-prob0
egen probhat0=mean(prob0)
egen probhat1=mean(prob1)
egen diffhat=mean(diff)
tempname prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi   
_pctile prob0, p(2.5,97.5) 
scalar `lo0' = r(r1)
scalar `hi0' = r(r2)  
_pctile prob1, p(2.5,97.5)
scalar `lo1'= r(r1)
scalar `hi1'= r(r2)  
_pctile diff, p(2.5,97.5)
scalar `diff_lo'= r(r1)
scalar `diff_hi'= r(r2)  
scalar `prob_hat0'=probhat0
scalar `prob_hat1'=probhat1
scalar `diff_hat'=diffhat
post mypost (`prob_hat0') (`lo0') (`hi0') (`prob_hat1') (`lo1') (`hi1') (`diff_hat') (`diff_lo') (`diff_hi')
drop x_betahat0 x_betahat1 prob0 prob1 diff probhat0 probhat1 diffhat 
display ""
postclose mypost
use sim2.dta, clear
append using sim.dta
save sim2.dta, replace
restore, not
**********   EDUCATION * SAMESEX Interaction
* Education: University vs. Middle-junior high (Edu3 vs Edu1) at Same rights (Samesex1) and 'Cut tax and spend' candidate (Tax3)
estimates use m10_coeEDU.ster
est des
preserve
drawnorm MG_b1-MG_b232, n(10000) means(e(b)) cov(e(V)) clear seed(1)
postutil clear
postfile mypost prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi using sim.dta, replace
noisily display "start"
generate x_betahat0 = MG_b150 + MG_b232 + MG_b1
generate x_betahat1 = MG_b150 + MG_b232 + MG_b3 + MG_b231 ///
+ MG_b17*h_pinterest + MG_b23*h_leftright + MG_b29*h_gender + MG_b35*h_age + MG_b41*h_italian + MG_b47*h_student + MG_b53*h_lyceum + MG_b59*h_eduimp ///
+ MG_b65*h_pinterest + MG_b69*h_leftright + MG_b73*h_gender + MG_b77*h_age + MG_b81*h_italian + MG_b85*h_student + MG_b89*h_lyceum + MG_b93*h_taximp ///
+ MG_b104 + MG_b115*h_survey + MG_b121*h_survey
gen prob0=normal(x_betahat0)
gen prob1=normal(x_betahat1)
gen diff=prob1-prob0
egen probhat0=mean(prob0)
egen probhat1=mean(prob1)
egen diffhat=mean(diff)
tempname prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi   
_pctile prob0, p(2.5,97.5) 
scalar `lo0' = r(r1)
scalar `hi0' = r(r2)  
_pctile prob1, p(2.5,97.5)
scalar `lo1'= r(r1)
scalar `hi1'= r(r2)  
_pctile diff, p(2.5,97.5)
scalar `diff_lo'= r(r1)
scalar `diff_hi'= r(r2)  
scalar `prob_hat0'=probhat0
scalar `prob_hat1'=probhat1
scalar `diff_hat'=diffhat
post mypost (`prob_hat0') (`lo0') (`hi0') (`prob_hat1') (`lo1') (`hi1') (`diff_hat') (`diff_lo') (`diff_hi')
drop x_betahat0 x_betahat1 prob0 prob1 diff probhat0 probhat1 diffhat 
display ""
postclose mypost
use sim2.dta, clear
append using sim.dta
save sim2.dta, replace
restore, not
* Education: University vs. Middle-junior high (Edu3 vs Edu1) at Some rights (Samesex2)  and 'Cut tax and spend' candidate (Tax3)
estimates use m10_coeEDU.ster
est des
preserve
drawnorm MG_b1-MG_b232, n(10000) means(e(b)) cov(e(V)) clear seed(1)
postutil clear
postfile mypost prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi using sim.dta, replace
noisily display "start"
generate x_betahat0 = MG_b150 + MG_b232 + MG_b1
generate x_betahat1 = MG_b150 + MG_b232 + MG_b3 + MG_b231 ///
+ MG_b17*h_pinterest + MG_b23*h_leftright + MG_b29*h_gender + MG_b35*h_age + MG_b41*h_italian + MG_b47*h_student + MG_b53*h_lyceum + MG_b59*h_eduimp ///
+ MG_b65*h_pinterest + MG_b69*h_leftright + MG_b73*h_gender + MG_b77*h_age + MG_b81*h_italian + MG_b85*h_student + MG_b89*h_lyceum + MG_b93*h_taximp ///
+ MG_b66*h_pinterest + MG_b70*h_leftright + MG_b74*h_gender + MG_b78*h_age + MG_b82*h_italian + MG_b86*h_student + MG_b90*h_lyceum + MG_b94*h_sseximp ///
+ MG_b104 + MG_b112 + MG_b115*h_survey + MG_b121*h_survey + MG_b122*h_survey
gen prob0=normal(x_betahat0)
gen prob1=normal(x_betahat1)
gen diff=prob1-prob0
egen probhat0=mean(prob0)
egen probhat1=mean(prob1)
egen diffhat=mean(diff)
tempname prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi   
_pctile prob0, p(2.5,97.5) 
scalar `lo0' = r(r1)
scalar `hi0' = r(r2)  
_pctile prob1, p(2.5,97.5)
scalar `lo1'= r(r1)
scalar `hi1'= r(r2)  
_pctile diff, p(2.5,97.5)
scalar `diff_lo'= r(r1)
scalar `diff_hi'= r(r2)  
scalar `prob_hat0'=probhat0
scalar `prob_hat1'=probhat1
scalar `diff_hat'=diffhat
post mypost (`prob_hat0') (`lo0') (`hi0') (`prob_hat1') (`lo1') (`hi1') (`diff_hat') (`diff_lo') (`diff_hi')
drop x_betahat0 x_betahat1 prob0 prob1 diff probhat0 probhat1 diffhat 
display ""
postclose mypost
use sim2.dta, clear
append using sim.dta
save sim2.dta, replace
restore, not
* Education: University vs. Middle-junior high (Edu3 vs Edu1) at No rights (Samesex3)  and 'Cut tax and spend' candidate (Tax3)
estimates use m10_coeEDU.ster
est des
preserve
drawnorm MG_b1-MG_b232, n(10000) means(e(b)) cov(e(V)) clear seed(1)
postutil clear
postfile mypost prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi using sim.dta, replace
noisily display "start"
generate x_betahat0 = MG_b150 + MG_b232 + MG_b1
generate x_betahat1 = MG_b150 + MG_b232 + MG_b3 + MG_b231 ///
+ MG_b17*h_pinterest + MG_b23*h_leftright + MG_b29*h_gender + MG_b35*h_age + MG_b41*h_italian + MG_b47*h_student + MG_b53*h_lyceum + MG_b59*h_eduimp ///
+ MG_b65*h_pinterest + MG_b69*h_leftright + MG_b73*h_gender + MG_b77*h_age + MG_b81*h_italian + MG_b85*h_student + MG_b89*h_lyceum + MG_b93*h_taximp ///
+ MG_b67*h_pinterest + MG_b71*h_leftright + MG_b75*h_gender + MG_b79*h_age + MG_b83*h_italian + MG_b87*h_student + MG_b91*h_lyceum + MG_b95*h_sseximp ///
+ MG_b104 + MG_b113 + MG_b115*h_survey + MG_b121*h_survey + MG_b123*h_survey
gen prob0=normal(x_betahat0)
gen prob1=normal(x_betahat1)
gen diff=prob1-prob0
egen probhat0=mean(prob0)
egen probhat1=mean(prob1)
egen diffhat=mean(diff)
tempname prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi   
_pctile prob0, p(2.5,97.5) 
scalar `lo0' = r(r1)
scalar `hi0' = r(r2)  
_pctile prob1, p(2.5,97.5)
scalar `lo1'= r(r1)
scalar `hi1'= r(r2)  
_pctile diff, p(2.5,97.5)
scalar `diff_lo'= r(r1)
scalar `diff_hi'= r(r2)  
scalar `prob_hat0'=probhat0
scalar `prob_hat1'=probhat1
scalar `diff_hat'=diffhat
post mypost (`prob_hat0') (`lo0') (`hi0') (`prob_hat1') (`lo1') (`hi1') (`diff_hat') (`diff_lo') (`diff_hi')
drop x_betahat0 x_betahat1 prob0 prob1 diff probhat0 probhat1 diffhat 
display ""
postclose mypost
use sim2.dta, clear
append using sim.dta
save sim2.dta, replace
restore, not
**********   INCOME (TASK NO.27)
* Income: Low (Inc1) 
estimates use m10_coeINC.ster
est des
preserve
drawnorm MG_b1-MG_b232, n(10000) means(e(b)) cov(e(V)) clear seed(1)
postutil clear
postfile mypost prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi using sim.dta, replace
noisily display "start"
generate x_betahat0 = MG_b150 + MG_b232 + MG_b4
generate x_betahat1 = MG_b150 + MG_b232 + MG_b4
gen prob0=normal(x_betahat0)
gen prob1=normal(x_betahat1)
gen diff=prob1-prob0
egen probhat0=mean(prob0)
egen probhat1=mean(prob1)
egen diffhat=mean(diff)
tempname prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi   
_pctile prob0, p(2.5,97.5) 
scalar `lo0' = r(r1)
scalar `hi0' = r(r2)  
_pctile prob1, p(2.5,97.5)
scalar `lo1'= r(r1)
scalar `hi1'= r(r2)  
_pctile diff, p(2.5,97.5)
scalar `diff_lo'= r(r1)
scalar `diff_hi'= r(r2)  
scalar `prob_hat0'=probhat0
scalar `prob_hat1'=probhat1
scalar `diff_hat'=diffhat
post mypost (`prob_hat0') (`lo0') (`hi0') (`prob_hat1') (`lo1') (`hi1') (`diff_hat') (`diff_lo') (`diff_hi')
drop x_betahat0 x_betahat1 prob0 prob1 diff probhat0 probhat1 diffhat 
display ""
postclose mypost
use sim2.dta, clear
append using sim.dta
save sim2.dta, replace
restore, not
* Income: Middle vs. Low (Inc2 vs Inc1) 
estimates use m10_coeINC.ster
est des
preserve
drawnorm MG_b1-MG_b232, n(10000) means(e(b)) cov(e(V)) clear seed(1)
postutil clear
postfile mypost prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi using sim.dta, replace
noisily display "start"
generate x_betahat0 = MG_b150 + MG_b232 + MG_b4
generate x_betahat1 = MG_b150 + MG_b232 + MG_b5 + MG_b18*h_pinterest + MG_b24*h_leftright + MG_b30*h_gender + MG_b36*h_age + MG_b42*h_italian + MG_b48*h_student ///
+ MG_b54*h_lyceum + MG_b60*h_incimp + MG_b116*h_survey + MG_b204
gen prob0=normal(x_betahat0)
gen prob1=normal(x_betahat1)
gen diff=prob1-prob0
egen probhat0=mean(prob0)
egen probhat1=mean(prob1)
egen diffhat=mean(diff)
tempname prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi   
_pctile prob0, p(2.5,97.5) 
scalar `lo0' = r(r1)
scalar `hi0' = r(r2)  
_pctile prob1, p(2.5,97.5)
scalar `lo1'= r(r1)
scalar `hi1'= r(r2)  
_pctile diff, p(2.5,97.5)
scalar `diff_lo'= r(r1)
scalar `diff_hi'= r(r2)  
scalar `prob_hat0'=probhat0
scalar `prob_hat1'=probhat1
scalar `diff_hat'=diffhat
post mypost (`prob_hat0') (`lo0') (`hi0') (`prob_hat1') (`lo1') (`hi1') (`diff_hat') (`diff_lo') (`diff_hi')
drop x_betahat0 x_betahat1 prob0 prob1 diff probhat0 probhat1 diffhat 
display ""
postclose mypost
use sim2.dta, clear
append using sim.dta
save sim2.dta, replace
restore, not
* Income: High vs. Low (Inc3 vs Inc1) 
estimates use m10_coeINC.ster
est des
preserve
drawnorm MG_b1-MG_b232, n(10000) means(e(b)) cov(e(V)) clear seed(1)
postutil clear
postfile mypost prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi using sim.dta, replace
noisily display "start"
generate x_betahat0 = MG_b150 + MG_b232 + MG_b4
generate x_betahat1 = MG_b150 + MG_b232 + MG_b6 + MG_b19*h_pinterest + MG_b25*h_leftright + MG_b31*h_gender + MG_b37*h_age + MG_b43*h_italian + MG_b49*h_student ///
+ MG_b55*h_lyceum + MG_b61*h_incimp + MG_b117*h_survey  + MG_b231
gen prob0=normal(x_betahat0)
gen prob1=normal(x_betahat1)
gen diff=prob1-prob0
egen probhat0=mean(prob0)
egen probhat1=mean(prob1)
egen diffhat=mean(diff)
tempname prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi   
_pctile prob0, p(2.5,97.5) 
scalar `lo0' = r(r1)
scalar `hi0' = r(r2)  
_pctile prob1, p(2.5,97.5)
scalar `lo1'= r(r1)
scalar `hi1'= r(r2)  
_pctile diff, p(2.5,97.5)
scalar `diff_lo'= r(r1)
scalar `diff_hi'= r(r2)  
scalar `prob_hat0'=probhat0
scalar `prob_hat1'=probhat1
scalar `diff_hat'=diffhat
post mypost (`prob_hat0') (`lo0') (`hi0') (`prob_hat1') (`lo1') (`hi1') (`diff_hat') (`diff_lo') (`diff_hi')
drop x_betahat0 x_betahat1 prob0 prob1 diff probhat0 probhat1 diffhat 
display ""
postclose mypost
use sim2.dta, clear
append using sim.dta
save sim2.dta, replace
restore, not
**********   CORRUPTION (TASK NO.27)
* Corruption: Clean (Corr1) 
estimates use m10_coeCOR.ster
est des
preserve
drawnorm MG_b1-MG_b232, n(10000) means(e(b)) cov(e(V)) clear seed(1)
postutil clear
postfile mypost prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi using sim.dta, replace
noisily display "start"
generate x_betahat0 = MG_b150 + MG_b232 + MG_b7
generate x_betahat1 = MG_b150 + MG_b232 + MG_b7
gen prob0=normal(x_betahat0)
gen prob1=normal(x_betahat1)
gen diff=prob1-prob0
egen probhat0=mean(prob0)
egen probhat1=mean(prob1)
egen diffhat=mean(diff)
tempname prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi   
_pctile prob0, p(2.5,97.5) 
scalar `lo0' = r(r1)
scalar `hi0' = r(r2)  
_pctile prob1, p(2.5,97.5)
scalar `lo1'= r(r1)
scalar `hi1'= r(r2)  
_pctile diff, p(2.5,97.5)
scalar `diff_lo'= r(r1)
scalar `diff_hi'= r(r2)  
scalar `prob_hat0'=probhat0
scalar `prob_hat1'=probhat1
scalar `diff_hat'=diffhat
post mypost (`prob_hat0') (`lo0') (`hi0') (`prob_hat1') (`lo1') (`hi1') (`diff_hat') (`diff_lo') (`diff_hi')
drop x_betahat0 x_betahat1 prob0 prob1 diff probhat0 probhat1 diffhat 
display ""
postclose mypost
use sim2.dta, clear
append using sim.dta
save sim2.dta, replace
restore, not
* Corruption: Investigated vs. Clean (Corr2 vs Corr1) 
estimates use m10_coeCOR.ster
est des
preserve
drawnorm MG_b1-MG_b232, n(10000) means(e(b)) cov(e(V)) clear seed(1)
postutil clear
postfile mypost prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi using sim.dta, replace
noisily display "start"
generate x_betahat0 = MG_b150 + MG_b232 + MG_b7
generate x_betahat1 = MG_b150 + MG_b232 + MG_b8 + MG_b20*h_pinterest + MG_b26*h_leftright + MG_b32*h_gender + MG_b38*h_age + MG_b44*h_italian + MG_b50*h_student ///
+ MG_b56*h_lyceum + MG_b62*h_honimp + MG_b118*h_survey + MG_b204
gen prob0=normal(x_betahat0)
gen prob1=normal(x_betahat1)
gen diff=prob1-prob0
egen probhat0=mean(prob0)
egen probhat1=mean(prob1)
egen diffhat=mean(diff)
tempname prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi   
_pctile prob0, p(2.5,97.5) 
scalar `lo0' = r(r1)
scalar `hi0' = r(r2)  
_pctile prob1, p(2.5,97.5)
scalar `lo1'= r(r1)
scalar `hi1'= r(r2)  
_pctile diff, p(2.5,97.5)
scalar `diff_lo'= r(r1)
scalar `diff_hi'= r(r2)  
scalar `prob_hat0'=probhat0
scalar `prob_hat1'=probhat1
scalar `diff_hat'=diffhat
post mypost (`prob_hat0') (`lo0') (`hi0') (`prob_hat1') (`lo1') (`hi1') (`diff_hat') (`diff_lo') (`diff_hi')
drop x_betahat0 x_betahat1 prob0 prob1 diff probhat0 probhat1 diffhat 
display ""
postclose mypost
use sim2.dta, clear
append using sim.dta
save sim2.dta, replace
restore, not
* Corruption: Corrupt vs. Clean (Corr3 vs Corr1) 
estimates use m10_coeCOR.ster
est des
preserve
drawnorm MG_b1-MG_b232, n(10000) means(e(b)) cov(e(V)) clear seed(1)
postutil clear
postfile mypost prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi using sim.dta, replace
noisily display "start"
generate x_betahat0 = MG_b150 + MG_b232 + MG_b7
generate x_betahat1 = MG_b150 + MG_b232 + MG_b9 + MG_b21*h_pinterest + MG_b27*h_leftright + MG_b33*h_gender + MG_b39*h_age + MG_b45*h_italian + MG_b51*h_student ///
+ MG_b57*h_lyceum + MG_b63*h_honimp + MG_b119*h_survey + MG_b231
gen prob0=normal(x_betahat0)
gen prob1=normal(x_betahat1)
gen diff=prob1-prob0
egen probhat0=mean(prob0)
egen probhat1=mean(prob1)
egen diffhat=mean(diff)
tempname prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi   
_pctile prob0, p(2.5,97.5) 
scalar `lo0' = r(r1)
scalar `hi0' = r(r2)  
_pctile prob1, p(2.5,97.5)
scalar `lo1'= r(r1)
scalar `hi1'= r(r2)  
_pctile diff, p(2.5,97.5)
scalar `diff_lo'= r(r1)
scalar `diff_hi'= r(r2)  
scalar `prob_hat0'=probhat0
scalar `prob_hat1'=probhat1
scalar `diff_hat'=diffhat
post mypost (`prob_hat0') (`lo0') (`hi0') (`prob_hat1') (`lo1') (`hi1') (`diff_hat') (`diff_lo') (`diff_hi')
drop x_betahat0 x_betahat1 prob0 prob1 diff probhat0 probhat1 diffhat 
display ""
postclose mypost
use sim2.dta, clear
append using sim.dta
save sim2.dta, replace
restore, not

gen MV = _n
eclplot diff_hat diff_hi diff_lo MV, estopts(msize(small)) rplottype(rspike) ciopts(msize(small)) graphregion(fcolor(white)) hor title ("Task No.27", size(2)) ///
ytitle("") ysca(noline) ylabel(0.5 " " 1 " " 2 " " 3 " " 4 " " 5 " " 6 " " 7 " " ///
8 " " 9 " "  10 " " 11 " " 12 " " 13 " " 14 " " 15 " " 16 " " ///
17 " " 18 " "  19 " " 20 " " 21 " " 22 " " 23 " " 24 " " 25 " ", noticks labsize(2)) ///
ylabel(, nolabels noticks labsize(2)) ///
xtitle("") xlabel(-0.8 "-.8" -0.6 "-.6" -0.4 "-.4" -0.2 "-.2" 0 "0" 0.2 ".2" 0.4 ".4", noticks labsize(2)) xline(0, lpattern(dot) lcolor(black) lwidth(medthin)) ///
text(1.5 0 "{it:More tax-spend}", place(c) just(center) size(2)) ///
text(4.5 0 "{it:Mantain tax-spend}", place(c) just(center) size(2)) ///
text(7.5 0 "{it:Less tax-spend}", place(c) just(center) size(2)) ///
text(10.5 0 "{it:More tax-spend}", place(c) just(center) size(2)) ///
text(13.5 0 "{it:Mantain tax-spend}", place(c) just(center) size(2)) ///
text(16.5 0 "{it:Less tax-spend}:", place(c) just(center) size(2)) ///
fxsize(40) saving(COE_27, replace)

graph combine COE_1.gph COE_14.gph COE_27.gph, graphregion(fcolor(white)) ycommon xcommon saving(Figure_A10, replace) cols(3) imargin(0 0 0 0)
exit
